Method 1 using a normal button from the All Windows Toolbox group:
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyVariable As Integer
MyVariable = 1000
ModbusRTUCom1.Write("40001", MyVariable)
End Sub
Method 2 using the BasicButton:
- Add a BasicButton to the form
- In the Properties Window set PLCAddressClick to 40001
- Set OutputType to WriteValue
- Set ValueToWrite to any value you want to write
- In your code, change the value to write like this:
BasicButton1.ValueToWrite="99"