This maybe of some use to someone , I've done this on a few forms for checking modbus addresses, 4 buttons and a textbox , I set the Disable Subscriptions for the driver to true so the form will not be communicating when the form is first loaded, I click the connect button when I want to start.
(Get Modbus Driver IP Button) This will get the driver IP and display it in the textbox.
Double Click on button and add this Code: TextBox1.Text = ModbusTCPCom1.IPAddress
(Change Modbus Driver IP Button) This will get the driver IP from the textbox and will now become your driver IP .
Double Click on button and add this Code: ModbusTCPCom1.IPAddress = TextBox1.Text
(Click to Connect Button) This will Disable comms for this driver
Double Click on button and add this Code: ModbusTCPCom1.DisableSubscriptions = "True"
(Click to Disconnect Button) This will enable comms for this driver
Double Click on button and add this Code: ModbusTCPCom1.DisableSubscriptions = "False"