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 a 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 C#.
This tutorial uses the modified "Simdemo.opf" project.

Writing to an Array-Tag:

Simply copy & paste the code below into the form constructor:

{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
string strPCName = "";
string strOPCServer = "SWToolbox.TOPServer";
string strTag = " Channel_1.Device_1.TagArray_1";
string strAccessPath = "";

try
{
   //
   //create our array of values we want to write to the tag
   int[] values = new int[]{0, 1, 2, 4, 5, 6, 7, 8, 9, 10};
  
   //
   //define our OPC Web Client objects
   EASYOPCDALib.EasyDA objOWC = new EASYOPCDALib.EasyDAClass();

           //
           //now to do the write
           objOWC.WriteItemValue(
               strPCName,
               strOPCServer,
               strTag,
               strAccessPath,
               values);
          
           //
           //display a message
           MessageBox.Show("Tag write a success!");  
   //
   //clean-up
   objOWC = null;
}
catch(Exception ex)
{
   MessageBox.Show("Error: " + ex.Message.ToString());
}

}

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