Forms are parent controls, and therefore have a property called Controls
which is a ControlCollection (essentially a special array of controls) that
maintains a list of child controls within it. In order for a control to be a
child to a parent, it must be added to this collection. The form designer
will automatically generate this code for you when you drag a TextBox onto a
form, otherwise you must do it manually.
So! Every form automatically maintains a list of controls with in it (as do
panels, groupboxes, etc) and you can just use that. You can even single out
controls in the list by the Name or Tag properties or however else you'd
like to manipulate a subset of controls in the collection. I wrote code for
this elsewhere in the thread.
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Abzieher Thomas <ta*****@etm-ag.com> wrote: i hva got an form with ten textboxes
and now i want to set all text properties of each to "test"
is ther anpossibility to do this like this
for (i=0 ; i++, i>10)
setProp("text"+i.toStrin()", "text", "test");
You can use reflection if you really *have* to have that structure -
but it would be far better for your form to have a method which took
the text box number and the new value, and kept the textboxes
themselves in an array.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too