Welcome to Dream.In.Code
Become a VB Expert!

Join 149,937 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,431 people online right now. Registration is fast and FREE... Join Now!




Exception from HRESULT: 0x80040202 in OPC Client OnDataChange Addhandl

 
Reply to this topicStart new topic

Exception from HRESULT: 0x80040202 in OPC Client OnDataChange Addhandl

prashant123
26 Dec, 2007 - 03:14 AM
Post #1

New D.I.C Head
*

Joined: 15 Jun, 2007
Posts: 1


My Contributions
Hi all,
I am developing OPC Client in VB.net. I have developed the code and reading OPC Items on Sampling as well as event based (OnDataChange). When I am working with local machine then my code works fine with both Sampling as well as OnDataChange, but when I am trying to read data from Remote OPC Server then Sampling works fine but I am not able fetch data on event based process. I am able to connect to the OPC Server but when i am adding subscription to it then i am getting error.

HRESULT : 0x80040202.
Public NetCredentials As New System.Net.NetworkCredential
Dim connectdt As Opc.ConnectData
Public WithEvents Subscription As ISubscription = Nothing
Public State As New Opc.Da.SubscriptionState

State = New Opc.Da.SubscriptionState

State.Active = True
State.UpdateRate = 500
Subscription = OpcServer.CreateSubscription(State)
results = Subscription.AddItems(Items)
AddHandler Subscription.DataChanged, New DataChangedEventHandler(AddressOf OnDataChange) ' Here is the error.

I appreciate if anybody suggests some solution.

Thanks in advance.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 04:24PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month