Write a word

The following program writes a user inputted number to
N7:0
when the
Write
button (Command1) is clicked, and reads the value stored in N7:0 to verify that the number was actually sent. The inputted number is stored in the text property of the text box named txtWrite_val. The returned value is stored in the text property of the text box named
txtRead_val
.
Sub Command1_Click ()
'Write value to N7:0
txtWrite_val.LinkTopic = "RSLinx|testsol"
'Define DDE application & topic
txtWrite_val.LinkItem = "N7:0"
'Define DDE item
txtWrite_val.LinkMode = 2
'Open DDE link (manual)
txtWrite_val.LinkPoke
'Poke Data to RSLinx
txtWrite_val.LinkMode = 0
'Close DDE link
'Read value from N7:0
txtRead_val.LinkTopic = "RSLinx|testsol"
'Define DDE application & topic
txtRead_val.LinkItem = "N7:0"
'Define DDE item
txtRead_val.LinkMode = 2
'Open DDE link (manual)
txtRead_val.LinkRequest
'Request data from RSLinx
txtRead_val.LinkMode = 0
'Close DDE link
End If
End Sub
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal