Example Code

Developing Industrial Automation Applications using Visual Basic .NET and OPC

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • OPC Servers

Code and Documents

Attachment

Download All

Description

This example is the completed client application that is developed in Application Note "Developing Industrial Automation Applications using Visual Basic .NET and OPC". To learn more about OPC, click the link below in Related Links section to go to our OPC page.

This example demonstrates how to use the .NET DataSocket control to communicate with OPC Servers. The example uses the National Instruments DemoOPC Server. You can easily change the connection string to communicate with any installed OPC Server. This example allows you to browse to select an OPC data item, connects to the OPC Server, and updates a graph as new data is received.

This example demonstrates a client application that reads from and writes to an OPC server. In addition, you can present a graphical browsing interface for users to select OPC items. Without changing any code, you also can connect this client application to any OPC server, including an OPC FieldPoint server or other OPC server (PLC or RTU).

As discussed in detail in the application note, the two attached projects respectively demonstrate connecting to OPC server through callback functions and data-binding approach.

Related Links:
National Instruments OPC webpage
 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.