In this example we update a label to display the sum of two value boxes. The value boxes are linked to two distinct tags and utilize the "OnEndValueChange" function.


double value1;
double value2;
void UpdateLineTotals(){
Label1.Text = (value1 + value2).ToString("N2");
}
public void ValueBox1_EndValueChange(object sender, Tag tag, DateTime timestamp, TVQ tvq)
{
double number;
if(double.TryParse(tvq.Value.ToString(), out number)) {
value1 = number;
UpdateLineTotals();
}
}
public void ValueBox2_EndValueChange(object sender, Tag tag, DateTime timestamp, TVQ tvq)
{
double number;
if(double.TryParse(tvq.Value.ToString(), out number)) {
value2 = number;
UpdateLineTotals();
}
}
Comments
0 comments
Please sign in to leave a comment.