Visavi Visual OPC .NET  

BrowseItemsForm Class

Represents a dialog box that allows the user to browse and select an OPC item or items.

For a list of all members of this type, see  BrowseItemsForm Members.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.Control
            System.Windows.Forms.ScrollableControl
               System.Windows.Forms.ContainerControl
                  System.Windows.Forms.Form
                     Visavi.Opc.Client.Forms.BrowseItemsForm

[Visual Basic]
 Public Class BrowseItemsForm
   Inherits Form
[C#]
 public class BrowseItemsForm: Form
[C++]
 public __gc class BrowseItemsForm : public Form
[JScript]
public class BrowseItemsForm extends Form

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

This class allows you to browse OPC items on a specific OPC server. The path to the server is specified with the ServerIdentifier property. Use the MaximumSelectionCount property to limit the number of items that the user may select. Show the dialog by calling the ShowDialog method. After the user has closed the dialog, retrieve the selected items with the SelectedItems property.

Example

[Visual Basic, C#] The following example uses the BrowseItemsForm and illustrates creating and showing the dialog box. The example uses the ShowDialog method to display the dialog box and return the DialogResult. The example then displays a MessageBox that lists the items selected by the user.

[Visual Basic] 
Protected Sub button1_Click(sender As Object, e As System.EventArgs)
   Dim identifier As New ResourceIdentifier()
   identifier.ProgID = "Visavi.OpcSimulation"
   Dim browseItemsForm As New BrowseItemsForm()
   browseItemsForm.ServerIdentifier = identifier
   If browseItemsForm.ShowDialog() = DialogResult.OK Then
      Dim itemsMessage As New String("Selected Items:\n")
      For Each item As String In browseItemsForm.SelectedItems
         itemsMessage += item + "\n"
      Next
      MessageBox.Show(itemsMessage)
   End If
End Sub

[C#] 
protected void button1_Click(object sender, System.EventArgs e)
{
   ResourceIdentifier identifier = new ResourceIdentifier();
   identifier.ProgID = "Visavi.OpcSimulation";
   BrowseItemsForm browseItemsForm = new BrowseItemsForm();
   browseItemsForm.ServerIdentifier = identifier;
   if (browseItemsForm.ShowDialog() == DialogResult.OK)
   {
      string itemsMessage = "Selected Items:\n";
      foreach (string item in browseItemsForm.SelectedItems)
         itemsMessage += item + "\n";

      MessageBox.Show(this, itemsMessage);
   }
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: Visavi.Opc.Client.Forms

Platforms:  Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family

Assembly: Visavi.Opc.Client.Forms

See Also

BrowseItemsForm Members | Visavi.Opc.Client.Forms Namespace