INGEAR.NET.ABLink

 

Tag.ErrorCode Property

Returns a numeric error code related to the last operation.

[Visual Basic]
NotOverridable Public ReadOnly Property ErrorCode As Integer _
    Implements ITag.ErrorCode
[C#]
public int ErrorCode {get;}

Property Value

Errors can be caused by invalid programming operations, or communication execution failures.  The ErrorCode property will provide a numeric error value. See WINSOCK Errors | CIP Errors | EXT/STS Errors | ResultCode constants

 

Implements

ITag.ErrorCode

 

Example

VB
Try
  ' ********************************
  ' * initialize controller and tag
   Dim MyPLC as New ABLink.Controller("192.168.1.32", CPU.SLC, Driver.ENET)
   Dim MyTag as New ABLink.Tag("N7:0")
   ' *******************************
   ' * set the value
   MyTag.Value = 1234
   {.. elsewhere in code...}
   
   ' *******************************
   ' * write value to PLC
   MyPLC.WriteTag(MyTag)
    
   ' *******************************
   ' * check the status
   If ResultCode.QUAL_GOOD = MyTag.QualityCode Then
      Console.WriteLine(MyTag.Timestamp.ToString())
   Else
      Console.WriteLine(MyTag.ErrorString)
   End If
   
   Console.WriteLine(MyTag.QualityString)
Catch ex As System.Exception
   Console.WriteLine(ex.Message)
End Try
   
C#
try
{
  //////////////////////////////////
  // initialize controller and tag
  ABLink.Controller MyPLC = new ABLink.Controller("192.168.1.32", CPU.SLC, Driver.ENET);
  ABLink.Tag MyTag = new ABLink.Tag("N7:0");
  /////////////////////////////////
  // set the value
  MyTag.Value = 1234;
  {... elsewhere in code...}
  /////////////////////////////////
  // write value to PLC
  MyPLC.WriteTag(MyTag);
  
  //////////////////////////////////
  // check results
  if(ResultCode.QUAL_GOOD == MyTag.QualityCode)
    Console.WriteLine(MyTag.Timestamp.ToString());
  else
    Console.WriteLine(MyTag.ErrorCode);
  Console.WriteLine(MyTag.QualityString);    
}
catch(System.Exception ex)
{
  Console.WriteLine(ex.Message);
}  

See Also

Tag Class | ABLink Namespace | ErrorString | QualityCode | QualityString