Hi Paul,
It's so close but I still can't get it to work. When I use ...GetValue(this), I get the error "Object reference not set to an instance of an object". I figured that was because the reference was to the form itself, rather than the control so I changed it to ...GetValue(txtName). I still get the error. I suspect it's still because it's reading the string rather than the reference to the control name, I just don't know what to do to get past that. I did make sure that the variable was indeed set to the name of a control on the form. Any ideas? Thanks.
>This is simplified so it's easier to see, but try something like this instead:
>
>
>for (int i = 1; i < 4; i++)
>{
> string txtName = "textBox" + i.ToString();
> TextBox control = (TextBox)this.GetType().GetField(txtName, MemberAccess).GetValue(this);
>
> control.Text = i.ToString();
>}
>
Linda Harmes
HiBit Technologies, Inc.