Write Array
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

 

Writing to 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.

Writing to 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 iDataType = 0

   Try
'
'define our OPC Web Client
     Dim objOWC As New EasyOPCDALib.EasyDA3
'
'now to create an array of values to write to our tag
     Dim arrValues() As Integer = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
'
'now to write the array to the tag
     objOWC.WriteItemValue( _
       strPCName, _
       strOPCServer, _
       strTag, _
       arrValues)
'
'now to make sure there was no error
     If Err.Number = 0 Then
       MessageBox.Show("Array Write successful!")
     Else
       MessageBox.Show("Error (" & Err.Number & ") " & Err.Description)
     End If
'
'now to dispose of our object
     objOWC = Nothing
'
   Catch ex As Exception
'
'display an exception to screen
     MessageBox.Show(ex.Message)
   End Try

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