Visavi Visual OPC .NET  

BrowseItemsForm.MaximumSelectionCount Property

Gets or sets the maximum number of OPC items that may be selected by the instance of the BrowseItemsForm dialog.

[Visual Basic]
Public Property MaximumSelectionCount As Integer

[C#]
public int MaximumSelectionCount {get; set;}

[C++]
public: __property int get_MaximumSelectionCount();
public: __property void set_MaximumSelectionCount(int);

[JScript]
public function get MaximumSelectionCount() : int;
public function set MaximumSelectionCount(int);

Property Value

Gets or sets the maximum number of OPC items that may be selected by the instance of the BrowseItemsForm dialog. The default value is -1, indicating that there is no limit to the number of items the user may select.

Remarks

Any value less than 0 (preferably -1) indicates that there is no limit to the number of items that may be selected.

When this property is 1, the look of the dialog changes so that the only the 'Available Items' list view appears. The item selected is then the item that is selected in the list.

Example

[Visual Basic, C#] The following example expounds on the example shown in the overview of the BrowseItemsForm by limiting the number of items to be selected to 1.

[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.MaximumSelectionCount = 1
   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.MaximumSelectionCount = 1
   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);
   }
}

Requirements

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

See Also

BrowseItemsForm Class | BrowseItemsForm Members | Visavi.Opc.Client.Forms Namespace