|
Please use our Code Center to obtain source-code and example projects/solutions:
http://codecenter.softwaretoolbox.com
|
|
|

|
|
|
|
|

|
|
OPC Browsing
Be sure to check out the OPC Browser Tutorial.
This page shows you how to:
- Browse available PC's
- Browse available OPC Servers (using the dialog and via code)
- Browse available OPC Groups/Branches (via code)
- Browse available OPC Tags (using the dialog and via code)
Browsing available PCs
'define our object browser Dim o As New OPCUserObjects.OPCUserBrowseMachine
'call the dialog o.RunMe
'display the output from the dialog MsgBox o.MachineName
Browsing Available OPC Servers
Via Dialog Browser
'define the object browser Dim o As OPCUserObjects.OPCUserBrowseMachine
'specify the computer to browse servers on o.MachineName = ""
'call the dialog to screen o.RunMe
'display the dialog output MsgBox o.MachineName
& "\" & o.ServerClass
Via Code
The following code assumes that an empty for exists with a single listbox control in it. Place the following code in the Form_load event:
'create the web client object Dim objOWC As New EasyDA3
'define the object to receive the servers listing Dim ServerElements
'specify the computer to go browsing on Dim strMachineName As String strMachineName = "127.0.0.1"
'get the server listing into our collection
Set ServerElements = objOWC.BrowseServers(strMachineName) 'now iterate thru collection Dim key
For Each key In ServerElements.Keys
'get the collection item into a usable object
Dim server Set server = ServerElements.Item(key) 'add the server details to the list List1.AddItem server.ProgID Next
Browsing Available OPC Groups/Branches
The following code assumes that an empty form exists with a single listbox control in it. Place the following code in the Form_load event:
'define the opc web client object Dim EasyDA As New EasyDA3
'define a variable to act as a collection of groups Dim BranchElements
'specify the name of the computer to browse on Dim strMachineName
strMachineName = ""
'get the groups into the collection Set BranchElements = EasyDA.BrowseBranches(strMachineName, "OPCLabs.KitServer.2", "")
'now iterate thru the collection Dim Key For Each Key In BranchElements.Keys
'get the collection item into an object
Dim BranchElement Set BranchElement = BranchElements.Item(Key) 'add the group (if it is a group) to the list
If BranchElement.IsBranch Then List1.AddItem BranchElement.ItemID End If Next
Browsing Available Tags
|
|

|
|
|
|

|
|
|