SWTB_Banner_Left_LogoOnly

Simple Read Without Code

clearpixel

HOME PRODUCT
DETAILS FREE
DEMO PRICING &
LICENSING RELATED
PRODUCTS SUPPORT ABOUT
US

SWTB_7Button_BlueLine

Simple Visual Basic Read Tutorial - No Code Needed!

This example shows you how easy it is to connect the OPC Data ActiveX to an OPC server to read data without writing any code. If you want to do this example on your computer, you will need to have the demo of the OPC Data ActiveX control and you will need a copy of Visual Basic 5.0 or 6.0. After installing the OPC Data ActiveX control, open Visual Basic and start a new project. This simple 5 step process gets you up and reading live data without writing a line of code.

1. Add the OPC Data Control to your VB Project - click on Project-->Properties or press Ctrl-T in Visual Basic to bring up the dialog below. Select "OPC Data Control" in the dialog and check it and click OK. Your VB toolbar will now show the OPC Data control as shown here.

Simple Read Example Step 1

2. Place some VB objects and the OPC Data Control on a form - here we have placed one copy of the OPC Data ActiveX control and 2 Text Boxes named "Text1" and "Text2" (by default) on the form. When you place the OPC Data ActiveX on the form a licensing dialog will be shown - you can dismiss it if you have a 10 day demo.

Form with Controls setup on it

3. Connect to the OPC server of your choice (browsing built in) - place your mouse over the OPC Data ActiveX on the form and right-click - select Properties on the menu that appears and the custom properties page for the OPC Data control is shown. Select the "OPC Server" tab - by default our Simulation server is listed as "OPCDataCtrl.OPCSimServer.1" -- you can leave that as is if you want to use our simulation server and click Apply to continue.

To use an a different OPC server then click browse and you will be able to connect to OPC servers of your choice. Keep in mind that if you are connecting to an OPC server on another machine over a network using DCOM, you will need to have appropriate security access over your network to do so.

Custom Properties Page

4. Browse your OPC server(s) for data points and connect to object properties (i.e. Text box .Text property) -

  • Select the Connections tab on the OPC Data ActiveX properties page and you will see in the "Controls" box a list of all the controls on the form - go to Text1 and select it's Text property by clicking on it

  • Click on the "Browse" button and through the dialog below pick a data point from our simulation server or if you are using your own OPC server then pick a point appropriate to your server by highlighting it in the items pane. You will see that an itemID is automatically created for you. Click "apply" and then "OK' to dismiss the Properties page dialog.

Browsing the OPC Server

5. Run your program to get live OPC process data - run your VB program by selecting Run- ->Start in the VB menu or pressing the F5 function key and you will see your live data automatically appearing in the text boxes.

Running Sample Program

Ready to write some data ? Proceed to our "Simple Write" example.

 

 | HOME | PRODUCT DETAILS | FREE DEMO | PRICING & LICENSING | RELATED PRODUCTS | SUPPORT | ABOUT US

P: 1-888-665-3678 (US-Sales) or 704-849-2773 (Support & International), F: 704-849-6388
148A East Charles Street, Matthews, North Carolina, USA 28105
Copyright Software Toolbox, Inc., 1996-2006, All Rights Reserved Worldwide.