This tutorial will certainly lead you exactly how to make use of COPC32 on Aesthetic Basic.NET. You have to set up COPC32 on your system before develop SCADA with Visual.NET and also COPC32 ActiveX control. And also we suppose that you have OPC Server on your local system already.

We will produce the straightforward type to review as well as contact OPC server on local systems. However you would certainly, like to attach to remote OPC web server. Please configure DCOM on both server and also client side by refer to tutorial of KEPWare at

The form we will certainly create is shown in Figure 1.

Number 1

When user insert numeric value in textbox as well as click switch ‘& lsquo; Compose ‚, COPC32 will contact OPC tag as well as reveal its value on ‘& lsquo

  1. ; Label1 ‚. Open Up Visual Studio.NET and crate brand-new task with VB.NET

Figure 2

Kind the name of this project as “& ldquo; TestCOPC32VBNET &

rdquo;. 2. Add COPC32 ActiveX control right into tool kit by pick food selection Devices > > Add/Remove Tool kit Things & hellip;

Figure 3

After that pick COPC32 received Figure 4.

Figure 4

Then click “& ldquo;

OK & rdquo; 3.Read here At our site Crate a switch, a textbox and label on type like shown in Figure 1

. 4. Select in toolbox as well as drag on the type.

5. Right click COPC32 control on the kind and select ActiveX homes.

Figure 5

Establish update rate to 100 msec. As well as select OPC Web server name to preferred OPC Server. You need to go into IP address or device name in ‘& lsquo; nodname ‚ textbox if you would like to link to remote OPC web server over the network.

Number 6

6. Select OPC Tag you want to connect to.

Number 7

Click OK.

This OPC Tag could be Readable and Writable. You can look at your OPC Web server like displayed in Figure 8.

Figure 8 OPC Tag residential properties.

Figure 9 Configure OPC tag index number = 0

And click OK to exit home pages.

Note: You can set up connected OPC tags by import OPC tag list from CSV documents which export from OPC Server. Please describe

As well as see “& ldquo; Exactly how to load OPC tags from CSV data”&

rdquo;. 7. Double click the form to go into to Form_Load occasion code sight.

8. Create the code to link to OPC web server and also get value of OPC tag index 0 to reveal on Label1.

Private Below Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Deals with MyBase. Load


Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))

End Sub

Note: If you have set up other OPC tag such as OPC tag index number = 1. You can get its value utilizing ‘& lsquo

; GetVl( “1)’”. 9. Select & ldquo; Closing & rdquo;

occasion name from

dropdown. Number 10 And also develop the code like following

Private Below Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase. Closing



End Sub

Keep in mind: We make use of “& ldquo; Application.DoEvents()” & rdquo; to waiting other task to end up before separate from OPC Server.

10. Back to make view. Dual click COPC32 control on the form to go into to “& ldquo; datChange & rdquo; occasion code view. Then develop the code to show OPC tag value on Label1 when the vale of OPC tag we are connected has changed.

Personal Below Axcopc1_datChange(ByVal sender As Object, ByVal e As System.EventArgs) Manages Axcopc1.datChange

Label1.Text = Convert.ToString(Axcopc1.GetVl( 0 ))

End Sub

11. Back to create design view. Dual click switch ‘& lsquo; Write ‚. Then create code to write vale to OPC tag which has index number = 0.

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Axcopc1.opcWrt(0, Convert.ToDouble(TextBox1.Text))

End Below

12. Test program by click F5. Place the number right into textbox as well as click ‘& lsquo; Write ‚. You can see the vale displayed in tag is equal to your enter number.

Number 11

The total associated code is received Figure 12.