SyncWrite method

Description
Writes values to one or more items in a group.
Syntax
SyncWrite
(NumItems As Long, ServerHandles() As Long, Values() As Variant, ByRef Errors() As Long)
NumItems
— Number of items to be written
ServerHandles
— Array containing server handles for the items to be written.
Values
— Array of values.
Errors
— Variant containing an Integer array of errors returned to the client indicating the success/failure of the individual item writes.
Remarks
The SyncWrite operation is a blocking operation, which means the function runs to completion before returning. Writes are not affected by the ACTIVE state of the group or item.
Example
Dim lNumitems As Long
Dim arHandles() As Long
Dim arErrors() As Long
Dim arValues() As Variant
Dim i As Long
'/* Specify number of items
lNumitems = MyOPCGroup.OPCItems.Count
ReDim arHandles(1 To lNumitems)
ReDim arValues(1 To lNumitems)
For i = 1 To lNumitems
arHandles(i) = MyOPCGroup.OPCItems(i).ServerHandle
arValues(i) = txtData(MyOPCGroup.OPCItems(i).ClientHandle).Text
Next
MyOPCGroup.SyncWrite lNumitems, arHandles, arValues, arErrors
'/* Verify no 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