The problem could be in that yoy have no assembly with TextBox loaded
use smth like this
string strType = "System.Windows.Forms.TextBox";
Assembly asm = Assembly.LoadWithPartialName("System.Windows.Forms");
Type tp = asm.GetType(strType);
object obj = Activator.CreateInstance(tp);
PS: LoadWithPartialName is depricated in .net 2.0
--
WBR,
Michael Nemtsev :: blog:
http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
"TheSteph" wrote:
> Try this :
> using System.Reflection;
> //...
> //...
> string strTypeName = "System.Windows.Form.TextBox";
> Object Obj = Activator.CreateInstance(strTypeName)
>
>
> Steph
>
>
> "TheSebaster" <(E-Mail Removed)> wrote in message
> news:8280773C-5EB6-44A7-B691-(E-Mail Removed)...
> > I would like to create an instance of System.Windows.Form.TextBox
> > but I just have the name of the objec in a string like that:
> >
> > string strType = "System.Windows.Form.TextBox";
> >
> > I tryed myOgject = CreateInstance(Type.GetType(strType))
> > but it does not work because Type.GetType(strType) rturn null.
> >
> > Does anybody can help me???
> >
> > --
> > C# est a Mozart ce que
> > VB est a Normand L''amour
>
>
>