Returns numeric error value the Controller's most recent operations
Numeric error code value: ResultCode or CIP Errors class for possible list of errors.
ErrorCodes with a value of 100xxx (e.g. 10057) are Windows Sockets errors and not listed in the ResultCode constants.
VB
Try
' ************************************
' * initialize controller class
Dim MyPLC as New Logix.Controller()
' ************************************
' * set IP Address
MyPLC.IPAddress = "192.168.1.31"
' ************************************
' * connect to PLC
MyPLC.Connect()
' ************************************
' * check for errors
If MyPLC.Error = ResultCode.E_SUCCESS Then
Console.WriteLine("Connect Success")
Else
Console.WriteLine(MyPLC.ErrorString)
End If
Catch ex As System.Exception
Console.WriteLine(ex.Message)
End Try
C#
try
{
///////////////////////////////////////
// initialize controller class
Logix.Controller MyPLC = new Logix.Controller()
///////////////////////////////////////
// set IP Address
MyPLC.IPAddress = "192.168.1.31"
///////////////////////////////////////
// connect to plc
MyPLC.Connect();
///////////////////////////////////////
// check for error
if (ResultCode.E_SUCCESS != MyPLC.ErrorCode)
Console.WriteLine(MyPLC.ErrorString);
}
catch(System.Exception ex)
{
Console.WriteLine(ex.Message);
}
Controller Class | Logix Namespace | ErrorString