|
Description |
Notification that an error has occurred and the control cannot complete data transaction NOTE: nErrorCode parameter changed to from signed short (VB Integer) to Long in version 6.0 |
|
VB 6.0 |
Sub ABCTL_OnErrorEvent( nErrorCode as Long ) |
|
VC ++ |
void CABCTL::OnErrorEvent ( long nErrorCode ) |
|
VB .NET |
Private Sub AxABCTL1_OnErrorEvent(ByVal sender As Object, ByVal e As AxABCTLLib._DABCTLEvents_OnErrorEventEvent) Handles AxABCTL1.OnErrorEvent
|
|
Parameters |
nErrorCode - An error code describing the failure. nErrorCode < 0 is an IN-GEAR driver related error. nErrorCode > 0 is a PLC related error |
|
Remarks |
When OnErrorEvent fires, the control is providing you notification the read/write transaction with the PLC has failed.
|
|
VB 6.0 Example |
Sub Command1_Click() Sub ABCTL1_OnErrorEvent( nErrorCode as Integer) |
|
VC ++ Example |
void MyCWndClass:: OnBtn1Click() void MyCWndClass:: ABCTLOnErrorEvent( short nErrorCode ) CString errMsg; errMsg.Format ("Communication Error %d", nErrorCode ); AfxMessageBox(errMsg); |
|
VB .NET Example |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click AxABCTL1.Adapter = 0 ' * use adapter 0 AxABCTL1.Node = 2 ' * to PLC Node 2 AxABCTL1.Function = 1 ' * WRITE PLC AxABCTL1.FileAddr = "N7:0" ' * starting at N7:0 AxABCTL1.CtlSize = 3 ' * for 3 data points AxABCTL1.set_WordVal(0,1) ‘ * value for N7:0 AxABCTL1.set_WordVal(1,1) ‘ * value for N7:1 AxABCTL1.set_WordVal(2,2) ‘ * value for N7:2 AxABCTL1.Trigger() ' * tell control to write the data End Sub
Private Sub AxABCTL1_OnErrorEvent(ByVal sender As Object, ByVal e As AxABCTLLib._DABCTLEvents_OnErrorEventEvent) Handles AxABCTL1.OnErrorEvent
Dim nErrorCode as System.Int16 nErrorCode = AxABCTL1.ErrorCode Text1.Text = "Communication Error " & nErrorCode |
|
Also See |