INGEAR.NET.MBLINK

 

Controller.WriteTag Method 

Writes an instance of a Tag or an array of Tag classes to the MODBUS device

[Visual Basic]
Public Function WriteTag( _
   ParamArray Tag As Tag() _
) As Integer
[C#]
public int WriteTag(
   params Tag[] Tag
);

Parameters

Tag
Instance of a Tag or array of Tags

Return Value

The result of the operation ResultCode

Remarks

If the instance of the Controller class is not already Connected, calling this method will automatically establish the connection.

Exceptions

Exception Type Condition
ArgumentNullException Thrown if Tag parameter is a null reference (Nothing in Visual Basic)
InvalidOperationException Thrown if Tag parameter is not Tag Type, or if Name> is null or empty, or Value is null

Example

VB
Imports MBLink
Dim MBDevice As New Controller("192.168.1.45")
Dim MyTag As New Tag("40001")
MyTag.Value = Convert.ToInt16(100)
MBDevice.WriteTag(MyTag)
C#
using MBLink;
Controller MBDevice = new Controller("192.168.1.45");
Tag MyTag = new Tag("40001");
MyTag.Value = Convert.ToIn16(100);
MBDevice.WriteTag(MyTag);

See Also

Controller Class | MBLink Namespace | GroupWrite | Now | ReadTag