<< 点击显示目录 >> 主页 PVI通信 > PVI帮助信息 > PVI Services > BR.AN.Namespace > BR.AN.PviServices > VariableEventArgs Class > VariableEventArgs Properties > VariableEventArgs.ChangedMembers Property |
Gets a collection of changed member elements for array and structure variables.
[Visual Basic]
Public ReadOnly Property ChangedMembers() As String
Public Get
End Get
End Property
[C#]
public string[] ChangedMembers { public get; }
通过连接一个结构或数组类型的变量,有可能获得这个列表中那些价值改变的元素。
Reading values from structure elements
Variable structVar = new Variable(cpuObj,"stVar");
structVar.Connect();
structVar.Active = true;
// 创建事件处理程序
structVar.ValueChanged += new VariableEventHandler(Var_ValueChanged);
...
...
private void Var_ValueChanged(object sender, VariableEventArgs e)
{
Variable tmpVar = (Variable)sender;
if (tmpVar.Value.DataType == DataType.Structure )
{
// 迭代ChangedMembers属性
foreach ( String strVar in e.ChangedMembers )
{
// 通过字符串索引访问数值 -> tmpVar.Value["subSt.subElem_INT"]
labelText.Text += String.Format("{0} {1}\n",strVar,tmpVar.Value[strVar].ToString());
}
}
...
...
}
VariableEventArgs Class | BR.AN.PviServices Namespace
Generated from assembly BR.AN.PviServices [8.1.0.4]