Sign in to follow this  
Followers 0
phuz

VB.NET OPC

2 posts in this topic

I have my OPC working well in Excel VBA, but I want to write a VB.NET app and I am having some beginner issues. I get this error upon pressing CONNECT "Unable to cast object of type 'RSLinxOPCAutomation.OPCServerClass' to type 'RSLinxOPCAutomation.IOPCGroups'." Imports RSLinxOPCAutomation Public Class Form1 Dim WithEvents OPCServer1 As OPCServer Dim WithEvents OPCGroup1 As OPCGroup Dim MyOPCItems() As OPCItem Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click OPCServer1 = New OPCServer OPCServer1.Connect("RSLinx OPC Server") OPCGroup1 = OPCServer1.OPCGroups.Add("TestGroup") ReDim MyOPCItems(1) MyOPCItems(1) = OPCGroup1.OPCItems.AddItem("[MixerRecipe]N7:0", 1) End Sub End Class

Share this post


Link to post
Share on other sites
The problem is that the the RSLinx Automation wrapper is compiled using a code stack that was not developed for interoperability with .Net. In the early days the OPC Foundation provided a code stack that went to all OPC Server manufacturers. It was up do each of us to compile this and ensure that it worked with our products. This was before the Foundation had the ability to maintain code with its own staff. Since that time most manufactures distribute the same automation wrapper. If you look at KEPServerEX V4 installs you will see that we installed a KEPDAAuto.dll and an OPCDAAuto.dll. The latter is the .Net compliant version. Feel free to download the KEPServerEX V5. If you install it with the Samples the Automatiion Wrapper will be installed and then you can use it in your new examples. We also provide new examples that use the .Net Interop as wel.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0