- Add a Button to your form from the All Windows Forms group
- Double click the button and add the code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If MsgBox("Are you sure?", Microsoft.VisualBasic.MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
ModbusRTUCom1.Write("40001", "1")
End If
End Sub