INGEAR.NET.MBLINK

 

Controller.ErrorCode Property

Returns a numeric value of the error code encountered by the Controller class

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

Property Value

ResultCode

Implements

IController.ErrorCode

Remarks

ErrorCode will reflect the probably cause of failure. The ErrorString property provides a description of the error.

Operational Error - E_xxx error codes. See ResultCode

WINSOCK Error - 100xx error codes. Windows has a problem with the network subsystem an unknown Win32 error comes back with a number (like e.g. 10060).

Device Errors - Errors reported by the MODBUS TCP/IP device. Please consult the device's users manual for resolution.  

Example

VB
 Imports MBLink
 Dim MBDevice As New Controller()
 MBDevice.IPAddress = "192.168.1.45"
 MBDevice.Connect()
 If MBDevice.ErrorCode = ResultCode.E_SUCCESS Then
    MessageBox.Show("Connect Success")
 Else
    MessageBox.Show(MBDevice.ErrorString)
 End If
 
 C#  
 using MBLink;
 Controller MBDevice = new Controller()
 MBDevice.IPAddress = "192.168.1.45";
 MBDevice.Connect();
 if (MBDevice.ErrorCode == ResultCode.E_SUCCESS)
    MessageBox.Show("Connect Success");
 else
    MessageBox.Show(MBDevice.ErrorString);

See Also

Controller Class | MBLink Namespace | ErrorString