Read Array Tag
Home Product
Details Free 
Demo Pricing &
Ordering Related
Products Support About Us

Please use our Code Center to obtain source-code and example projects/solutions:

http://codecenter.softwaretoolbox.com

 

Read Array-Tag Example, VB6This example assumes you have the TOPServer installed with the "simdemo.opf" project loaded.

The following example builds upon the Tutorial Using in VB6.

Within the "Form_Load()" event, place the following code:

Dim objOPCWebClient
   '
   'create the OPC Web Client object

   Set objOPCWebClient As New EasyDA3
  '
   'now call the method to read a tag, specifying the
   'name of the OPC Server and the Tag...

 Dim objValueTimeQuality
   Set objValueTimeQuality = objOPCWebClient.ReadItem("", "SWToolbox.TOPServer", _
         "Channel_1.Device_1.TagArray_1 ", "", 0)
  '
   'now display a value or an error...

   If Err.Number
= 0 Then
      '
       'now look and see if the value returned is an array
       If IsArray(objValueTimeQuality .Value) Then
         '
           'this is an array, so now show each element within the array

            Dim item As Variant
           For Each item In objValueTimeQuality.Value
               MsgBox "Value of array element is: " & item
           Next

           '
       Else
           '
           'this is not an array, so just display the value
           MsgBox "Value not an array, but value is: " & objValueTimeQuality .Value
       End If
       '
   Else
     '
       'an error occurred, so display an error message

       MsgBox "An error occurred: " & Err.Number
   End If

Copyright Software Toolbox, Inc., 1996-2004, All Rights Reserved Worldwide.
148A East Charles Street, Matthews, North Carolina, USA 28105
Phone: 704-849-2773 or 1-888-665-3678 (US), Fax: 704-849-6388
sales@softwaretoolbox.com | support@softwaretoolbox.com