SWTB_Banner_Left_LogoOnly

INGEAR.NET.Logix
Read a Tag

clearpixel

SWTB_6Button_BlueLine

.NET Winforms Application - How to Read A Tag

This example was built using Visual Studio 2003, so your .NET environment may be a little different. But the concept remains the same.

  1. Create a new .NET project.
  2. Add in a reference to the INGEAR.NET.Logix component. The name of the file to add will be "INGEAR.NET.Logix.dll" and will be located in the INGEAR.NET.Logix installation directory

  3. Create a text box on your form.
  4. Create a button on the form, and go to the code routine that handles the "OnClick" event.
  5. Add in the following lines of code (changing the IP address, Path, and Tag Name as needed):

    Dim m_nResult as Integer
    Dim ignController As New Logix.Controller
    Dim ignTag As New Logix.Tag

    ignController.IPAddress = "127.0.0.1"
    ignController.Path = "0"
    m_nResult = ignController.Connect()

    ignTag.Controller = ignController
    ignTag.Length = 1
    ignTag.Name = "YourTagAddress"
    m_nResult = ignController.ReadTag(ignTag)
    txbValue.Text = String.Format("{0}", ignTag.Value)

    ignController.Disconnect()



  6. Compile and Run


Of course, you will need to check for result codes from the Connect and ReadTag methods, but you get the idea. A few lines of code and you've got data!

Need more examples? How about entire sample projects? Visit our Software Toolbox CodeCenter for a list of sample code using the INGEAR.NET.Logix component.

 

 

 | HOME | PRODUCTS | FREE TRIAL SOFTWARE | SUPPORT & TUTORIALS | PRODUCT NEWS | PURCHASING

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

Software Toolbox is a registered trademark of Software Toolbox Inc.
INGEAR, INGEAR.NET, INGEAR.NET.Logix, INGEAR.NET.ABLink, INGEAR.NET.GELink, and INGEAR.NET.MBLink are all trademarks of Cimquest Inc.