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.ToString() );
if ( current.Controls.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**************@TK2MSFTNGP10.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*@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com... like that:
for (int i = 0; i<=this.Controls.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.onclick event:
for (int i = 0; i<=this.components.Components.count - 1; i++)
MessageBox.Show(this.components.Components[i].ToString());
But when I click button, system show error message.
How can I show all components names on form?