passing array in tag property of control (C#.net winforms)
Posted on 2006-06-12
I am dynamically building controls on a screen and need to attach some values for later reference to each control. I attached an array of 2 values to each control through the Tag property. So now I'm where I need to get those values out but I cannot figure out the syntax to access them. Sorry if this is a lame question...I'm new at C#.net. This is how I attached them:
string strCtrlArray = new string;
strCtrlArray = strReportParameterName;
strCtrlArray = strParmCtrlProperty;
Type ctype = Type.GetType(strClsName);
objCtrl = Activator.CreateInstance(ctype);
strProp = "Tag";
pinf = ctype.GetProperty(strProp);
pinf.SetValue(objCtrl, strCtrlArray, null);
this.Controls.Add(objCtrl as Control);
I know the values are there in an array because I can see them in debug. But I can't figure out the syntax to get them out.
Thank you so much for your help!