AdvancedHMI Software
General Category => Support Questions => Topic started by: rmac on March 23, 2017, 06:24:21 PM
-
Is there a way to catch this exception inside the application?
It's clear I'm getting the error because there is no connection with the PLC, but I would like to be able to catch/report that, instead of getting this pop up message from .Net Framework.
If I hit Continue the program resumes operation, without showing any readings from the PLC of course.
Any help will be appreciated.
-
Is this happening where you are performing a Write with your own code? If so, you need to be sure to wrap all of your Read and Writes in a Try-Catch
Try
EthernetIPforSLCMicroCom1.Write("N7:0","1")
Catch ex as Exception
msgbox("Write failed. " & ex.message)
End Try
[/doe]
-
You are right. As usual.
I'm trying to write/send some values to the PLC from the code.
Will try your suggestion asap.
THANK YOU.
-
Should I use Try for every read/write, or I can group several read/write operations inside one Try?
-
I put a group of "write to PLC" commands inside the Try and it did work.
I realized that a reaction to the first one is enough.
Got my response to the exception "under control" now.
Thanks again Archie.
Much appreciation.