Visual Basic Tutorial – Point Edit – Step 3 code:

Option Explicit
Dim srv As Server
Dim pt As PIPoint

Private Sub Combo1_Click()
   Set srv = Servers(Combo1.Text)
End Sub

Private Sub Command1_Click()
On Error GoTo HANDLER
   If Text1.Text = "" Then
      MsgBox "Please enter a tagname"
      Exit Sub
   End If
   Set pt = srv.PIPoints(Text1.Text)
   Dim ptatr As PointAttribute
   List1.Clear
   For Each ptatr In pt.PointAttributes
      List1.AddItem ptatr.Name
   Next
Exit Sub
HANDLER:
   MsgBox Err.Description
End Sub

Private Sub Command2_Click()
Dim Cxn As New PISDKDlg.Connections
Dim s As PISDK.Server
On Error Resume Next
   Set s = Cxn.Login(srv, , , True)
   If Err.Number <> 0 Then
      MsgBox Err.Description
   Else
      If s.Connected Then
         MsgBox "Successfully connected to " & s.Name
      End If
   End If
End Sub

Private Sub Form_Load()
   Dim cur As Integer
   Dim dflt As Integer
   cur = 0
   dflt = 0
   For Each srv In Servers
      Combo1.AddItem srv.Name
      If srv.Name = Servers.DefaultServer.Name Then
         dflt = cur
      End If
      cur = cur + 1
   Next
   Combo1.ListIndex = dflt
   Set srv = Servers(Combo1.Text)
End Sub
Enabling Operational Intelligence