Das sollte gehen:
Partial Class ThisProject
Dim WithEvents zOLV As zenOn.IOnlineVariable
Private Sub ThisProject_Startup(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Startup
'get object if already exists
zOLV = Me.OnlineVariables().Item("MyOLV")
If zOLV Is Nothing Then
'if not exitst, create a new OnlineVariable container
zOLV = Me.OnlineVariables.CreateOnlineVariables("MyOLV")
End If
'add variables to the container
zOLV.Add("Var_int_01")
zOLV.Add("Var_int_02")
zOLV.Add("Var_int_03")
zOLV.Add("Var_int_04")
'activate 'VariableChange' event
zOLV.Define()
End Sub
Private Sub ThisProject_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Shutdown
'delete all Variables from Container and
'deactivate VariableChang' event
If Not zOLV Is Nothing Then
OnlineVariables.DeleteOnlineVariables("MyOLV")
zOLV.Undefine()
End If
End Sub
'event is fired when a variable value changes
Private Sub zOLV_VariableChange(ByVal obVar As zenOn.IVariable) Handles zOLV.VariableChange
System.Diagnostics.Debug.Print(obVar.Name & " " & obVar.get_Value.ToString())
End Sub
End Class