Hi,
you have to check if each control has controls like this:
void PrintControl( Control parent)
{
foreach( Control current in parent.Controls )
{
MessageBox.Show ( current.ToStrin g() );
if ( current.Control s.Count > 0 )
PrintControl( current );
}
}
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"sergey" <no****@nomail. com> wrote in message
news:uQ******** ******@TK2MSFTN GP10.phx.gbl...
Hi guy,
Thanks for your answer,
Your code shows components which parent is form. Is there any simple way
to show all objects (parent is not important) on form?
"guy" <gu*@discussion s.microsoft.com > wrote in message
news:A5******** *************** ***********@mic rosoft.com... like that:
for (int i = 0; i<=this.Control s.Count - 1; i++)
MessageBox.Show (this.Controls[i].Name);
"sergey" wrote:
Hi,
I want show all components names on form when I press button. I wrote this code button's.onclic k event:
for (int i = 0; i<=this.compone nts.Components. count - 1; i++)
MessageBox.Show (this.component s.Components[i].ToString());
But when I click button, system show error message.
How can I show all components names on form?