A
Till now I made applications in VB6. Now I want to use Visual Studio 2005 (VB.NET). But I have problem to create groups.
The VB return:Unable to cast object of type 'SAOPCAutomation.OPCServerClass' to type 'SAOPCAutomation.IOPCGroups'.
Code:
Dim AnOPCServer As SAOPCAutomation.OPCServer
Dim ARealOPCServer As String
Dim ARealOPCNodeName As String
Dim AnOPCServerBrowser As SAOPCAutomation.OPCBrowser
Dim MyGroups As SAOPCAutomation.OPCGroups
Dim DefaultGroupUpdateRate As Long
Dim OneGroup As SAOPCAutomation.OPCGroup
Dim AnOPCItemCollection As SAOPCAutomation.OPCItems
Dim AnOPCItem As SAOPCAutomation.OPCItem
Dim AnOPCItemIDs(100) As String
Dim AnOPCItemServerHandles() As Long
Dim AnOPCItemServerErrors() As Long
AnOPCServer = New SAOPCAutomation.OPCServer
ARealOPCServer = "Schneider-Aut.OFS"
ARealOPCNodeName = "compaq1"
AnOPCServer.Connect(ARealOPCServer, ARealOPCNodeName)
MyGroups = AnOPCServer.OPCGroups ' error in this line
I have tested the Schneider OFS version 2.5 and the DEMO Version 3.2.
Please, help me!!! Where can I find any sample code for VB.NET and OPC. Best regardes and Best Wishes in 2006!
Andrej Mulej
The VB return:Unable to cast object of type 'SAOPCAutomation.OPCServerClass' to type 'SAOPCAutomation.IOPCGroups'.
Code:
Dim AnOPCServer As SAOPCAutomation.OPCServer
Dim ARealOPCServer As String
Dim ARealOPCNodeName As String
Dim AnOPCServerBrowser As SAOPCAutomation.OPCBrowser
Dim MyGroups As SAOPCAutomation.OPCGroups
Dim DefaultGroupUpdateRate As Long
Dim OneGroup As SAOPCAutomation.OPCGroup
Dim AnOPCItemCollection As SAOPCAutomation.OPCItems
Dim AnOPCItem As SAOPCAutomation.OPCItem
Dim AnOPCItemIDs(100) As String
Dim AnOPCItemServerHandles() As Long
Dim AnOPCItemServerErrors() As Long
AnOPCServer = New SAOPCAutomation.OPCServer
ARealOPCServer = "Schneider-Aut.OFS"
ARealOPCNodeName = "compaq1"
AnOPCServer.Connect(ARealOPCServer, ARealOPCNodeName)
MyGroups = AnOPCServer.OPCGroups ' error in this line
I have tested the Schneider OFS version 2.5 and the DEMO Version 3.2.
Please, help me!!! Where can I find any sample code for VB.NET and OPC. Best regardes and Best Wishes in 2006!
Andrej Mulej