TypeOf question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a routine that enumerates all controls in a windows form.
I what to enumerate also the controls that are inside a GroupBox or Panel,...

There is any way to know what is the type of the control being enumerated?

ex: if (typeOf ctl is Panel)
//Get all controls from this parent


Thanks for your help,
 
=?Utf-8?B?QmVybmFyZG8=?= said:
I have a routine that enumerates all controls in a windows form.
I what to enumerate also the controls that are inside a GroupBox or
Panel,...

There is any way to know what is the type of the control being enumerated?

ex: if (typeOf ctl is Panel)
//Get all controls from this parent

Well, you could use ctl.GetType(), but really I think you just want:

if (ctl is Panel)
{
....
}
 
Back
Top