Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

SubscribeMultipleItems in VB(A)

More
09 Aug 2012 08:43 #971 by Gert-Jan
All clear. Thanks again.
I have just been playing with it a bit and got good results. I did run into another little issue to do with the use of PercentDeadband, but I will post that question on a different thread.
GJF

Please Log in or Create an account to join the conversation.

More
09 Aug 2012 08:29 #970 by support
Yes, coding for ItemChanged event is simpler.
Using MultipleItemsChanged is a bit more efficient - but not too much. The savings are in the fact that just one event is fired if there are lots of changes coming in. You still need, however, to access the details of each event by calling into the component, causing number of round-trips - so the performance savings are not big.

Please Log in or Create an account to join the conversation.

More
09 Aug 2012 08:18 #969 by Gert-Jan
That's fantastic. Thanks very much, Zbynek!
A follow-on question, if you don't mind. What is the benefit of using "_ItemChanged", instead of "_MultipleItemsChanged"? Or does it just make your sample code a bit simpler?
GJF

Please Log in or Create an account to join the conversation.

More
08 Aug 2012 16:52 #965 by support
The VB6 example project is attached.
SubscribeMultipleItems.zip
You need to reference "OPC Labs EasyOPC Type Library":
1.png
The actual code looks like this:

Dim WithEvents easyDAClient As easyDAClient

Private Sub Form_Load()
Set easyDAClient = New easyDAClient
easyDAClient.SubscribeMultipleItems _
"", _
"OPCLabs.KitServer.2", _
Array("Simulation.Random", "Trends.Ramp (1 min)", "Trends.Sine (1 min)", "Simulation.Register_I4"), _
1000
End Sub
Private Sub Form_Unload(Cancel As Integer)
easyDAClient.UnsubscribeAllItems
Set easyDAClient = Nothing
End Sub
Private Sub easyDAClient_ItemChanged(ByVal varSender As Variant, ByVal varE As Variant)
Dim eventArgs As EasyDAItemChangedEventArgs
Set eventArgs = varE

List1.AddItem eventArgs.ItemDescriptor.ItemId & ": " & eventArgs.Vtq.ToString()
End Sub

And here is a display from sample run:
2.png
I hope this helps.

Please Log in or Create an account to join the conversation.

More
08 Aug 2012 09:31 #964 by support
Hello.
I will prepare it; should be today or by tomorrow.
Best regards
Zbynek Zahradnik

Please Log in or Create an account to join the conversation.

More
08 Aug 2012 08:03 #963 by Gert-Jan
Hi there!
Could anyone share a bit of sample code (including declarations/references) to illustrate the use of “SubscribeMultipleItems” in VB6 or VBA? Many thanks!
GJF

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.051 seconds