Type.GetType returns null for Systems.Windows.Forms.TextBox

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

Guest

Hi,

the foillowing line returns a null value
Type.GetType("System.Windows.Forms.TextBox")

why is that so ... and what should i do if i need to compare if the control
is a textbox or not?

Regards,
Nabeel
 
Nabeel said:
Hi,

the foillowing line returns a null value
Type.GetType("System.Windows.Forms.TextBox")

why is that so ... and what should i do if i need to compare if the control
is a textbox or not?

Control someControl = ...;

if (someControl is Textbox) {
// it is!
}

hth,
Max
 
the foillowing line returns a null value
Type.GetType("System.Windows.Forms.TextBox")

why is that so ...

Because you didn't specify which assembly it should look in. You have
to include the full assembly qualified name.

and what should i do if i need to compare if the control
is a textbox or not?

The easiest way would be to reference System.Windows.forms.dll and
write

if (yourControl is TextBox) ...


Mattias
 
Back
Top