D Connaughty
Member
Hello there,
I have been trying to assign a vb script to a button in graphics designer..... I created some internal tags in the win cc project. I wish that when a check box is selected, a value is added to another value upon a button being clicked. Below is the script I am using. Is there anything i am missing here? am i declaring the variables correctly? When the button is pressed I am expecting the result - which is "total" to be displayed in an i/o field. I have already tried this out in visual basic express 2010 and it works....
The "global script diagnostics window" also does not display anything when i press the button. Does the disgnostics window work if a vb script is only active in a picture - and not listed in the "project modules?"
Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim VGrp
Set VGrp = HMIRuntime.Tags.CreateTagSet
VGrp.Add "bin1sel"
VGrp.Add "bin1"
VGrp.Add "total"
VGrp.Read
If HMIRuntime.Tags("bin1sel").read = 1 Then
HMIRuntime.Tags("total").Value = HMIRuntime.Tags("bin1") + HMIRuntime.Tags("total")
End If
End Sub
I have been trying to assign a vb script to a button in graphics designer..... I created some internal tags in the win cc project. I wish that when a check box is selected, a value is added to another value upon a button being clicked. Below is the script I am using. Is there anything i am missing here? am i declaring the variables correctly? When the button is pressed I am expecting the result - which is "total" to be displayed in an i/o field. I have already tried this out in visual basic express 2010 and it works....
The "global script diagnostics window" also does not display anything when i press the button. Does the disgnostics window work if a vb script is only active in a picture - and not listed in the "project modules?"
Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim VGrp
Set VGrp = HMIRuntime.Tags.CreateTagSet
VGrp.Add "bin1sel"
VGrp.Add "bin1"
VGrp.Add "total"
VGrp.Read
If HMIRuntime.Tags("bin1sel").read = 1 Then
HMIRuntime.Tags("total").Value = HMIRuntime.Tags("bin1") + HMIRuntime.Tags("total")
End If
End Sub