Show Method Example (TagSearch Object)

For this example, open a new visual basic executable project. Make a reference to the PI-SDK Dialogs, the PISDK Type Library, and the PISDKCommon Type Library.  Drop 2 list box and 2 command buttons on a form. Change the MultiSelect property of List1 to Extended.

 

Option Explicit

 

Dim nvs As NamedValues

Dim PtList As PointList

 

Private Sub Form_Load()

  Dim srv As Server

  For Each srv In Servers

  List1.AddItem srv.Name

  Next

End Sub

 

' TagSearch.Show method with no servers or options specified.

Private Sub Command1_Click()

  Set PtList = TagSearch.Show

  FillPointList

End Sub

 

' TagSearch.Show method with servers and options specified.

' The server names are specified in nvs, which is a NamedValues collection.

Private Sub Command2_Click()

  CopyListToNamedValues

  Set PtList = TagSearch.Show(nvs, _

  tsoptDisableServerPickList + _

  tsoptSingleSelect)

  FillPointList

End Sub

 

Private Sub CopyListToNamedValues()

  Dim Index As Integer

  Set nvs = Nothing

  Set nvs = New NamedValues

  For Index = 0 To List1.ListCount - 1

  If List1.Selected(Index) Then

  nvs.Add List1.List(Index), 0

  End If

  Next

End Sub

 

Private Sub FillPointList()

  Dim pt As PIPoint

  List2.Clear

  For Each pt In PtList

  List2.AddItem pt.PathName

  Next

End Sub

Enabling Operational Intelligence