AdvancedHMI Software
General Category => Open Discussion => Topic started by: tamnguyen408 on July 12, 2016, 02:03:34 PM
-
Hi all,
How do I check PLC online or offline when Program starting up? Thanks in advance
-
If you did not set SuppressErrorDisplay to True, then most controls will display a message indicating a connection could not be made.
Most of the drivers also have 3 events:
ConnectionEstablished
ConnectionClosed
ComError
You can make event handlers for these events to know when there is a connection issue.
-
Thanks, Archie
will take a look tonight
-
Hi Archie,
I have not check my program yet.
Please! Give me an example code how to check connection established function call?
many thanks,
-
The easiest way may be to perform a read in a Try-Catch block:
Try
ModbusTCPCom1.Read("40001")
catch ex as exception
msgbox "Failed to read." & ex.message
end try
You can double click in a blank area of the form to get to the form load event and put the above code.
-
Thank you very much Archie
-
Thanks for your help... Archie
It works both VB.NET and C#