Returns a numeric value of the error code encountered by the Controller class
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.
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);
Controller Class | MBLink Namespace | ErrorString