OPC Studio User's Guide and Reference
Installed Examples - WindowsForms - WindowsFormsApplication1

The simplest Windows Forms application. Reads and displays an OPC "Classic" (OPC-DA) item value on a form. This is what you get if you follow the steps described in Quick Start for QuickOPC.NET.

The form:

// $Header: $
// Copyright (c) CODE Consulting and Development, s.r.o., Plzen. All rights reserved.

// ReSharper disable NotNullMemberIsNotInitialized

//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using System.Windows.Forms;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                object value = easyDAClient1.ReadItemValue("", "OPCLabs.KitServer.2", "Demo.Single");
                textBox1.Text = value?.ToString() ?? "";
            }
            catch (OpcException opcException)
            {
                textBox1.Text = $"*** {opcException.Message}";
            }
        }
    }
}
' $Header: $
' Copyright (c) CODE Consulting and Development, s.r.o., Plzen. All rights reserved.

'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel

Public Class Form1

    ' ReSharper disable InconsistentNaming
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As EventArgs) Handles MyBase.Load
        ' ReSharper restore InconsistentNaming

        Try
            TextBox1.Text = EasyDAClient1.ReadItemValue("", "OPCLabs.KitServer.2", "Demo.Single")
        Catch opcException As OpcException
            TextBox1.Text = $"*** {opcException.Message}"
        End Try
    End Sub
End Class

 

See Also

Conceptual

Installed Examples - WPF

Installed Examples - Console