Skip to content

Instantly share code, notes, and snippets.

@clope031
Created May 15, 2020 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clope031/ec11628185143816608003bfdb5eb9ce to your computer and use it in GitHub Desktop.
Save clope031/ec11628185143816608003bfdb5eb9ce to your computer and use it in GitHub Desktop.
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