Visual Basic Tutorial – Point Edit – Step 2 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 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