在用VB.NET編寫OPC讀寫西門子S7400程序時候,碰到以上句柄問題,請問該問題如何解決?
Public Shared MyItemServerHandles2 As System.Array
Private Sub PLC_AsyncWrite(ByVal NumItemsW As Integer, ByRef ItemValuesW() As System.Object, ByRef MyErrors As System.Array)
Dim lHandle(U_NUMITEMS) As System.Array
Dim i As Integer
If MyGroup2 Is Nothing Then
Exit Sub
End If
If MyGroup2.OPCItems.Count > 0 Then
lTransID_Rd2 = lTransID_Rd2 + 1
For i = 1 To 30
lHandle(i) = MyItemServerHandles2(NumItemsW)
MyGroup2.AsyncWrite(1, lHandle(i), ItemValuesW,
MyErrors, lTransID_Rd2, lCancelID_Rd2)
Next
End If
End Sub
參考談談VB.NET數組的使用中VB.NET數組的聲明,應該是
Dim lHandle(U_NUMITEMS) As Integer