Represents a method that will handle a change in data
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,
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());
}
Namespace: MBLink
Assembly: INGEAR.NET.MBLINK (in INGEAR.NET.MBLINK.dll)