AliasSearch Show Method Example

For this example, open a new visual basic executable project.  Add the PI-SDK Control component, and make a reference to the PI-SDK Dialogs, the PISDK Type Library, and the PISDKCommon Type Library.  Drop a PI-SrvPickList, 1 list box, and 3 command buttons on a form.  Copy and paste the following code to the form.

 

Option Explicit

Dim Connect As New Connections
Dim AliasList As PIAliasList2

Private Sub Command1_Click()
 On Error GoTo Handler
 Set AliasList = AliasSearch.Show(PISrvPickList1.SelectedServer)
 ShowAliasList
 Exit Sub
Handler:
 MsgBox Err.Number & vbCrLf & Err.Description
End Sub

Private Sub Command2_Click()
 On Error GoTo Handler
 Set AliasList = AliasSearch.Show( _
        "\\" & PISrvPickList1.SelectedServer.Name, _
         tsoptDisableSearchContext + tsoptSingleSelect)
 ShowAliasList
 Exit Sub
Handler:
 MsgBox Err.Number & vbCrLf & Err.Description
End Sub

Private Sub Command3_Click()
  Connect.ShowConnectionDialog False, vbModal
End Sub

Private Sub Form_Load()
  Command3.Caption = "Connections"
End Sub

Private Sub ShowAliasList()
  On Error GoTo Handler
 Dim Alias As PIAlias
 List1.Clear
 For Each Alias In
AliasList
    List1.AddItem Alias.Name & " (Alias)"
    List1.AddItem "   " & Alias.Server.Name & " (Server)"
    List1.AddItem "   " & Alias.DataSource.Server.Name & " (DataSource Server)"
    List1.AddItem "   " & Alias.DataSource.Name & " (DataSource)"
 Next
 Exit Sub
Handler:
 MsgBox Err.Number & vbCrLf & Err.Description
End Sub

 

 

Enabling Operational Intelligence