Oh I accidently posted in wrong subforum. It is in DA.
This is what I've tried so far, I keep getting "Value does not fall withing expected range". Why is that?
public void AsyncReadStart(string groupName, ListView formListView)
{
newListView = formListView;
asyncGroupNames.Add(groupName);
int numItems = structOPCServers[selectedNodeindex].opcServer.OPCGroups.GetOPCGroup(groupName).OPCItems.Count+1;
structOPCServers[selectedNodeindex].a_serverHandles = new int[numItems];
int i = 1;
foreach(OPCItem item in structOPCServers[selectedNodeindex].opcGroup.OPCItems)
{
structOPCServers[selectedNodeindex].a_serverHandles.SetValue(item.ServerHandle, i);
i++;
}
int transID = 1231;
//int NumItems, ref Array ServerHandles, out Array Errors, int TransactionID, out int cancelIDs
structOPCServers[selectedNodeindex].opcServer.OPCGroups.GetOPCGroup(groupName).AsyncRead(numItems, ref structOPCServers[selectedNodeindex].a_serverHandles, out structOPCServers[selectedNodeindex].a_errors, transID, out int cancelID);
//Exception appears in line above.
structOPCServers[selectedNodeindex].opcServer.OPCGroups.GetOPCGroup(groupName).AsyncReadComplete += OPC_Logic_AsyncReadComplete;
}
Can you please provide me with example code, I've tried to cast it to different types and much more none seem to work.
This is metadata from IOPCGroup:
void AsyncRead(int NumItems, ref Array ServerHandles, out Array Errors, int TransactionID, out int CancelID);
Â
AsyncRead(numItems, ref structOPCServers[selectedNodeindex].a_serverHandles, out structOPCServers[selectedNodeindex].a_errors, transID, out cancelID);
In my code:
numItems is int
structOPCServers[selectedNodeindex].a_serverHandles is Array
structOPCServers[selectedNodeindex].a_errors is Array
transID is int
cancelID is int
I really have no idea what to do.
1 Guest(s)