INGEAR.NET.Logix

 

Controller.ErrorString Property

Returns string describing the error of Controller's most recent operations

[Visual Basic]
NotOverridable Public ReadOnly Property ErrorString As String _
    Implements IController.ErrorString
[C#]
public string ErrorString {get;}

Property Value

ResultCode class and CIP Error Codes for possible list of errors.

Implements

IController.ErrorString

 

Example

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);
}      

See Also

Controller Class | Logix Namespace | ErrorCode