auto_mitch
Full Member level 3
visual basic micrologix
Hi all!
I have a problem with micrologix 1000 interface. i want to get the status of each Input or Output of the device. The communication between PLC and PC is accomplished through DDE protocol. This part works fine. The program reads the bit which corresponds to the I:0/0 Input and shows it's status 0 or 1 to a text. I also want that, when the text's value will be 0, a Shape object (circle) will become red, and the opposite, when the text's value will be 1, a Shape object (circle) will become green. My problem is that when the text change the shape's color is still red. could you please help me? Thanx for your time!
Hi all!
I have a problem with micrologix 1000 interface. i want to get the status of each Input or Output of the device. The communication between PLC and PC is accomplished through DDE protocol. This part works fine. The program reads the bit which corresponds to the I:0/0 Input and shows it's status 0 or 1 to a text. I also want that, when the text's value will be 0, a Shape object (circle) will become red, and the opposite, when the text's value will be 1, a Shape object (circle) will become green. My problem is that when the text change the shape's color is still red. could you please help me? Thanx for your time!
Code:
Private Sub Form_Load()
Dim Input1 As Integer
Text1.LinkTopic = "RSLinx|My_Prog" ' Set the application name and topic name.
Text1.LinkItem = "N7:22/0" ' Set LinkItem.
Text1.LinkMode = vbLinkAutomatic ' Set LinkMode to Automatic.
Text1.LinkRequest ' Update text box.
Text1.Text = Input1
If Input1 = 0 Then
Shape1.FillColor = QBColor(12)
Else: Shape1.FillColor = QBColor(10)
End If
End Sub