1. Need .DLL and files !! find DLLs online
Search in google for DLL files
1 2 |
items[0] = new Opc.Da.Item(); items[0].ItemName = "kutay zorlu"; |
2. Dll Usings
1 2 3 4 5 6 7 8 9 10 |
using Opc.Da; using Server=Opc.Da.Server; using Factory=OpcCom.Factory; string urlstring = string.Format("opcda://{0}/{1}/{{{2}}}", _hostName, _serverName, serverid); Server s = new Server(new Factory(), new URL(urlstring)); ItemIdentifier itemId = null; BrowsePosition position; BrowseFilters filters = new BrowseFilters() {BrowseFilter = browseFilter.item}; BrowseElement[] elements = s.Browse(itemId, filters, out position); |
VB EXamples
Public Function Browse(ByRef node As TreeNode, Optional id As Opc.ItemIdentifier = Nothing) As Integer
Try this to for solution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
Dim clone As Opc.Da.Server = your_connected_server Dim filters As New Opc.Da.BrowseFilters filters.BrowseFilter = Opc.Da.browseFilter.all Dim pos As Opc.Da.BrowsePosition = Nothing Dim elements() As Opc.Da.BrowseElement = clone.Browse(id, filters, pos) If (elements IsNot Nothing) Then For Each element As Opc.Da.BrowseElement In elements Console.WriteLine(element.ItemName) AddBrowseElement(node, element) If (element.HasChildren = True) Then id = New Opc.ItemIdentifier(element.ItemPath, element.ItemName) Browse(node.Nodes.Item(node.Nodes.Count - 1), id) End If Next End If Return 0 Catch ex As Exception RaiseEvent OnException(GetCurrentMethod, ex) Return -1 End Try End Function Private Sub AddBrowseElement(ByRef parent As TreeNode, element As Opc.Da.BrowseElement) Dim node As TreeNode = New TreeNode(element.Name) node.Text = element.Name node.Tag = element ' add properties If (element.Properties IsNot Nothing) Then For Each [property] As Opc.Da.ItemProperty In element.Properties AddItemProperty(node, [property]) Next End If ' add to parent. parent.Nodes.Add(node) End Sub |