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

|
|
|
|
|

|
|
Read an Array-Tag Example
This example assumes you have the TOPServer installed with the "simdemo.opf" project loaded.
The following example builds upon the Tutorial - using with VB.NET.
Reading an Array-Tag:
Simply copy & paste the code below into the Form_load() event:
'
'the following constants are used here to help make the code more readable 'from an educational perspective. 'Feel free to modify the contents of the values below.
Const strPCName = "" Const strOPCServer = "SWToolbox.TOPServer" Const strTag = "Channel_1.Device_1.TagArray_1"
Const strAccessPath = "" Const iDataType = 0
Try ' 'define our OPC Web Client
Dim objOWC As New OPCLabs.EasyOPCDANet.EasyDACOM ' 'define the object to receive the value, quality and timestamp
Dim objTagVTQ As OPCLabs.EasyOPCDANet.IVTQNet ' 'now to make the call to read the tag
objTagVTQ = objOWC.ReadItem _ strPCName, _ strOPCServer, _ strTag, _ strAccessPath, _
iDataType) ' 'now to make sure the object is an array If IsArray(objTagVTQ.Value
) Then ' 'now to show the value to the screen Dim objArray As Array = objTagVTQ.Value
Dim strValues As String For i As Integer = 0 To objArray.GetLength(0) - 1 strValues += objArray(i) & " "
Next MessageBox.Show("Value(s): " & strValues) Else '
'display an error MessageBox.Show("The Tag that was read is NOT an array!") End If '
'now to destroy the objects objTagVTQ = Nothing objOWC = Nothing '
Catch ex As Exception ' 'display an exception to screen MessageBox.Show(ex.Message)
End Try
|
|

|
|
|
|

|
|
|