AsyncRead method

Description
Read one or more items in a group. The results are returned via the AsyncReadComplete event associated with the OPCGroup object
Syntax
AsyncRead
( NumItems As Long, ServerHandles() As Long, ByRef Errors() As Long, TransactionID As Long, ByRef CancelID As Long)
NumItems
— Number of items to be read.
ServerHandles
— Array containing server handles for the items to be read.
Errors
— Variant containing an Integer array of errors returned to the client indicating the success/failure of the individual items to be read.
TransactionID
— The client specified transaction ID. This is included in the 'completion' information provided in the AsyncReadComplete Event.
CancelID
— A Server generated CancelID. This is provided to enable the client to cancel the Transaction.
Remarks
The AsyncRead requires the OPCGroup object to have been dimensioned to handle events (Dim WithEvents MyOPCGroup As OPCGroup) in order for the results of the AsyncRead operation to be returned to the client. The AsyncReadComplete event associated with the OPCGroup object will be called by the Data Access Server with the results of the AsyncRead operation.
Example
Dim lNumitems As Long
Dim arHandles() As Long
Dim arErrors() As Long
Dim lTransID As Long
Dim lCancelID As Long
Dim MyOPCItem As OPCItem
'/* Specify number of elements
lNumitems = MyOPCGroup.OPCItems.Count
ReDim arHandles(1 To lNumitems)
For i = 1 To lNumitems
'pass in server handles
arHandles(i) = MyOPCGroup.OPCItems(i).ServerHandle
Next 'i
MyOPCGroup.AsyncRead lNumitems, arHandles, arErrors, lTransID, lCancelID
'/* Check for errors
For i = 1 To lNumitems
If arErrors(i) > 0 Then
txtStatus = MyOPCServer.GetErrorString(arErrors(i))
End If
Next 'i
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal