First the GlobalDataItem is not found so this is needed
using Neo.ApplicationFramework.Tools.OpcClient;
But then it will not find my tag!?
I have added the StringToTag function
Code: Select all
public GlobalDataItem StringToTag(string tagName)
{
string typeName = (new GlobalDataItem()).GetType().Name;
PropertyInfo[] props = Globals.Tags.GetType().GetProperties();
foreach (PropertyInfo prop in props) {
if (prop.PropertyType.Name.Equals(typeName)) {
if (prop.Name.Equals(tagName, StringComparison.CurrentCultureIgnoreCase)) {
return (GlobalDataItem)prop.GetValue(Globals.Tags, null);
}
}
}
return null;
}
Code: Select all
void Button_Click(System.Object sender, System.EventArgs e)
{
GlobalDataItem tag = StringToTag("ShutterNotOpen");
if(tag!=null)
{
tag.Value = "Hello World";
}
else
{
MessageBox.Show("Can't find Tag");
}
}
But the StringToTag always returns null
I'm using iX Developer version 2.20
Anyone knows why and how to fix this???
// Anders