OPCDA.NET Reference Manual
OPCDA.NET New Class Template
Send comments on this topic.
OPCDA.NET Client Component > Application Development > C# Client Development > OPCDA.NET New Class Template

Glossary Item Box

Use the class wizard to add an OPC client class to an existing project.
The class wizard is activated from the "Add New Item" menu.

The OPCDA.NET Class Wizard adds a reference to the OpcDaNet.dll assembly and an OPC client class to the project. The class contains small sample code that browses the installed OPC servers and connects to the named server. Either use, modify or delete the sample code and add the project specific OPC client code.

 

Action Description

 

Add Class

 

1) In the current project right click the project name in the solution explorer window.
2) select Add - Add New Item and select the OPCDA.NET Client Class template
3) Modify the File Name, then click Open
The class file is created and added to the project together with a reference to the OpcDaNet.dll interface assembly.

Sample Code

The wizard created sample code does:
- browse the installed OPC Servers
- connect to the named OPC server
- disconnect from the OPC server

The sample code is in the namespace OpcDAClient. Either add a
using OpcDAClient;
statement to the modules using method of the OpcClient class
or change the namespace name to the default project namespace.

OPCDA.NET Assembly

The wizard copies the OpcDaNet.dll interface assembly from the template directory into the project directory.
The project works with this version of the wrapper DLL even if other projects use a different version.

To upgrade the project to a new version of the Wrapper assembly you need to:
- copy the new version into the project directory
- delete the OpcDaNet assembly reference in the VS project
- add a reference to the current OpcDaNet.dll

 

 

In Visual Studio 2005 two different ItemTemplates are available:

Template Description

 

OpcDaNetClass

 

A class with sample OPC DA server access code is added to the project.
Such a class is typically used for background OPC handling.

 

Usage:

1) In the current project right click the project name in the solution explorer window.
2) select Add - Add New Item and select the OpcDaNetClass template
3) Modify the File Name, then click Open
The class file is created and added to the project together with a reference to the OpcDaNet.dll interface assembly.

Sample Code The wizard created sample code does:
- connect to an OPC server
- creates a group with few items
- reads the item values
- has a method with sample code for DataBind usage

 

OPCDA.NET Assembly The wizard copies the OpcDaNet.dll interface assembly from the OPCDA.NET setup directory into the project directory.
The project works with this version of the wrapper DLL even if other projects use a different version.
To upgrade the project to a new version of the Wrapper assembly you need to:
- copy the new version into the project directory
- delete the OpcDaNet assembly reference in the VS project
- add a reference to the current OpcDaNet.dll

 

 

OpcdaNetForm

 

A Form based class is added to the project.
The created class has some user interface dialogs and the OPC server access code according the selections in the Wizard dialog.

The wizard user dialog and the created sample code is the same as in the OPCDA.NET project template.

Copyright © 2002-2018 Advosol Inc. All Rights Reserved.