Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dim g_eng As CaoEngine
Dim g_ctrl As CaoController
Dim g_val As CaoVariable
Private Sub Command1_Click()
' Read variable
Text1.Text = g_val.Value
End Sub
Private Sub Command2_Click()
' Write variable
g_val.Value = CBool(Text2.Text)
End Sub
Private Sub Form_Load()
Set g_eng = New CaoEngine
' Connect RC: IP setting depends on your RC setting.
Set g_ctrl = g_eng.Workspaces(0).AddController("RC8", "CaoProv.DENSO.RC8", "", "Server=192.168.0.1")
' Variable name "IO150"
Set g_val = g_ctrl.AddVariable("IO150", "")
End Sub
Private Sub Form_Unload(Cancel As Integer)
' Delete variable object
g_ctrl.Variables.Clear
Set g_val = Nothing
' Delete controller object
g_eng.Workspaces(0).Controllers.Remove g_ctrl.Index
Set g_ctrl = Nothing
' Delete CaoEngine
Set g_eng = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.