INGEAR.NET.MBLINK

DataChange Delegate

Represents a method that will handle a change in data

[Visual Basic]
Public Delegate Sub DataChange( _
   ByVal sender As Object, _
   ByVal e As DataChangeEventArgs _
)
[C#]
public delegate void DataChange(
   object sender,
   DataChangeEventArgs e
);

Parameters

sender
Instance of the Tag class that invoked the Changed event.
e
Data associated with the change.

Remarks

Change event will only fire when the Active property = true and under the following conditions:

ReadTag or GroupRead detects a change in the Value property Controller.ReadTag or Controller.GroupRead detects a change in the QualityCode property,

Example

VB
Imports MBLink
Dim MBDevice As New Controller("192.168.1.45")
Dim WithEvents MyTag As New Tag("40001")

' * add the event handler
AddHandler MyTag.Changed,  AddressOf MyTag_Changed

' * Read the tag
MBDevice.ReadTag(MyTag)

' * Event Handler
Private Sub MyTag_Changed(ByVal sender As Object, ByVal e As MBLink.DataChangeEventArgs) Handles Tag1.Changed)
  If e.QualityCode = ResultCode.QUAL_GOOD Then
    Console.WriteLine(e.Value.ToString())
  End If  
End Sub
C#
using MBLink
Controller MBDevice = new Controller("192.168.1.45")
Tag MyTag = new Tag("40001")

// add the event handled
MyTag.Changed += new MyTag.ChangedEventHandler(MyTag_Changed);

// read the tag
MBDevice.ReadTag(myTag);

// event handler
void MyTag_Changed(ByVal sender As Object, ByVal e As MBLink.DataChangeEventArgs) Handles Tag1.Changed)
{
  if( e.QualityCode == ResultCode.QUAL_GOOD)
    Console.WriteLine(e.Value.ToString());
}

Requirements

Namespace: MBLink

Assembly: INGEAR.NET.MBLINK (in INGEAR.NET.MBLINK.dll)

See Also

MBLink Namespace