Well, maybe it was worth asking. The code you have (once corrected) will
display names of all the controls in the form's Controls collection, but it
will not necessarily get all the controls on a form. If you have a container
control (such as Panel), then any controls on the Panel will not be in the
form's Controls collection, it will be in the Panel's collection. To really
catch them all, you'd need something like this:
private void Write_Controls_to_output(Control ctrl)
{
// For debugging...
// Writes a line to output for each Control on the form
Console.WriteLine(ctrl.Name + " " + ctrl.GetType().ToString());
if ( ctrl.Controls != null && ctrl.Controls.count > 0 )
foreach( Control c in ctrl.Controls )
{
Write_Controls_to_output(c);
}
}
foreach( Control c in this.Controls)
Write_Controls_to_output(c);
-Rachel
web1110 said:
Arggggggghhhhhhhhhh!!!
Thank you. One of those things where you cannot see the forest for the
trees. It was late and I guess I should have quit. Sorry for wasting
everyones time.
expected