The provided VB Sample Client can be used as the starting point for an application specific client.
It is however just as well possible to start with creating a Windows application and then add the OPC access. The required steps are outlined below.
The easiest way to create a OPC client application is by using the invisible DAServer/DAgroup controls provided by the OCPDA.NET Professional Edition. Coding requirements are greatly reduced. Much of the configuration is done in the Visual Studio Designer and high quality server access handling is encapsulated in the controls.
For new Windows Form OPC client application the OPCDA.NET New Project Template can be used instead of the Windows Form template for simplified creation of an application. The template is in the Advosol template folder The template starts a Wizard dialog and creates a VB Windows application project with sample code according the dialog selections.
For an overview look at the sample code that reads an item value from an OPC server without doing any Windows user interface handling.
Action | Description |
Create Project |
Use the Visual Studio wizard to create a Windows Application |
OPCDA.NET Assembly reference | In the Solution Explorer right click 'References', select 'Add Reference' and browse to OpcDaNet.Dll |
Namespaces | Imports OPC Imports OPCDA Imports OPCDA.NET |
OPC Server Selection | Either: - define a server name literal or - browse the installed servers either locally or on a remote computer. |
Connect to server | Use one of the Connect methods in the OpcServer class to connect to the local or remote OPC server. |
Group Object | Add a group object for each set of items with the same characteristics. You may use the QuickUse classes or the OpcGroup class. |
Add Items to Group | The AddItems step is only required in OpcGroup objects. The QuickUse classes handle this management step internally. |
Read / Write | Access the items using one of the read/write methods in the OpcGroup, SyncIOGroup or RefreshGroup. |
Async Refresh | Items added to the RefreshGroup or an OpcGroup with enable data callback need not be read periodically. The OPC server reports signal changes and the user supplied callback handlers are activated to handle the signal change. |
Disconnect from server | The client needs to disconnect from the server for it to be released. |