Dear NG,
I am writing a .NET CF forms app. that needs to dynamically configure
buttons on a form. Since the forms designer doesn't like component arrays I
am using ordinary instance names for each button (btn0, btn1 etc.) as
private members of the form class, but need to reference these from a loop
that is iterating through the button config. information (array).
My question is how can I loop through a collection of buttons with names
like "btn0, btn1 etc." calling methods on each as the loop executes?
Pseudo-CS would look something like:
string[] buttonNames = new string[]{"foo", "bar", "etc"};
Button current;
for (int i=0; i<buttonNames.Length; i++)
{
current = this.ReflectionMagic.GetInstance("btn" + i);
current.Text = buttonNames[i];
}
Please note that I have diligently RTFM & STFW to no avail, and so any help
would be greatly appreciated.
Thanks,
James.
PS. Please remove anti-spam for email replies.