Visual Studio 2017 tag command

35 views
Skip to first unread message

Donald Dahlman

unread,
Nov 7, 2025, 4:46:40 PMNov 7
to libplctag
This statement has errors with the tag call
var tag = new Tag("192.168.0.100", CpuType.SLC, "N7:0", DataType.Int16, 1);

the headers contain
using System;
using System.Windows.Forms;
using libplctag;

The statement was taken from the documentation

lib plc error.jpg
any one have a solution

Jake Porter

unread,
Nov 10, 2025, 12:24:34 PMNov 10
to Donald Dahlman, libplctag
That is old syntax, this is the Nuget example. // Example tag configuration for a global DINT tag in an Allen-Bradley CompactLogix/ControlLogix PLC
var myTag = new TagDint()
{
    Name = "SomeDINT",
    Gateway = "10.10.10.10",
    Path = "1,0",
    PlcType = PlcType.ControlLogix,
    Protocol = Protocol.ab_eip
};

// Read the value from the PLC and output to console
int output = myTag.Read();        
Console.WriteLine($"Original value: {output}");

// Write a new value to the PLC, then read it back, and output to console
myTag.Write(37);    
output = myTag.Read();
Console.WriteLine($"Updated value: {output}");

--
You received this message because you are subscribed to the Google Groups "libplctag" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libplctag+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/libplctag/ef753eed-540b-410d-893e-474b973fd09bn%40googlegroups.com.


--
Jacob(Jake) Porter
Clover Technology LLC
Electronic & Software Engineering Consulting
435-590-4026

Donald Dahlman

unread,
Nov 21, 2025, 11:01:08 AMNov 21
to libplctag
Thinking maybe the libplctag lib is not installed correctly
Dim myTag = New Tag() With
   {
       .Name = "PROGRAM:SomeProgram.SomeDINT",
       .Gateway = "192.168.0.1",
       .PlcType = PlcType.MicroLogix,
       .Protocol = Protocol.ab_eip,
       .Path = "1,0",
       .Timeout = TimeSpan.FromMilliseconds(5000)
   }


Type 'Tag' is not defined

Donald Dahlman

unread,
Nov 21, 2025, 11:01:15 AMNov 21
to libplctag
i switched over to VB with this code and it was fine
not sure what the issue was in C#


Imports libplctag

Public Class Form1
    Dim myTag As Tag

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        myTag = New Tag() With
  {
     .Name = "N7:0",
    .Gateway = "192.168.1.100",

    .PlcType = PlcType.MicroLogix,
    .Protocol = Protocol.ab_eip,
    .Path = "1,0",
    .Timeout = TimeSpan.FromMilliseconds(5000)
  }
    End Sub

    Private Sub btnCheckTag_Click(sender As Object, e As EventArgs) Handles btnCheckTag.Click
        myTag.Initialize()
        Dim myInt = myTag.GetInt16(0)
        myTag.Read()
        Label1.Text = myInt
    End Sub
End Class


On Friday, November 7, 2025 at 1:46:40 PM UTC-8 Donald Dahlman wrote:
Reply all
Reply to author
Forward
0 new messages