|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Invoking Class from a variable string in VB 2005...!I am trying to accede to a method of a class invoking(the class) from a variable string. The class is in other assembly called "infoInsumo" The code: Dim Tipo As Type = Type.GetType(Nodo) 'Nodo = "infoInsumo, infoInsumo" -->The assembly does not have root namespace Dim Clase As Object = Activator.CreateInstance(Tipo, Reflection.BindingFlags.CreateInstance) But in line "2" the following error jumps to me: Constructor on type 'infoInsumo' not found. What implementation I must make in the contructor of the class (infoInsumo) so that it can obtain my objective? From already thank you very much! Gustavo Arriola Make sure you have a reference to the DLL
and that the class is public. Tommaso Gustavo Arriola ha scritto: Show quoteHide quote > Hello to all! > I am trying to accede to a method of a class invoking(the class) from a > variable string. The class is in other assembly called "infoInsumo" > > The code: > > Dim Tipo As Type = Type.GetType(Nodo) 'Nodo = "infoInsumo, > infoInsumo" -->The assembly does not have root namespace > Dim Clase As Object = Activator.CreateInstance(Tipo, > Reflection.BindingFlags.CreateInstance) > > But in line "2" the following error jumps to me: > > Constructor on type 'infoInsumo' not found. > > What implementation I must make in the contructor of the class (infoInsumo) > so that it can obtain my objective? > > From already thank you very much! > Gustavo Arriola If, I have created a reference from VS 2005 and class she is public!
What I must do now? From already thank you very much! Gustavo Use fully qualified name of the Type:
"YourClass, YourAssembly" (or "YourNamespace.YourClass, YourAssembly") can also use: objType.Assembly.FullName.ToString see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclassassemblyqualifiednametopic.asp Tommaso Gustavo Arriola ha scritto: Show quoteHide quote > If, I have created a reference from VS 2005 and class she is public! > What I must do now? > > From already thank you very much! > Gustavo or also
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclassfullnametopic.asp tommaso.gasta***@uniroma1.it ha scritto: Show quoteHide quote > Use fully qualified name of the Type: > > "YourClass, YourAssembly" > > (or > "YourNamespace.YourClass, YourAssembly") > > can also use: > objType.Assembly.FullName.ToString > > see: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclassassemblyqualifiednametopic.asp > > Tommaso > > Gustavo Arriola ha scritto: > > > If, I have created a reference from VS 2005 and class she is public! > > What I must do now? > > > > From already thank you very much! > > Gustavo |
|||||||||||||||||||||||