Invoking Class from a variable string in VB 2005...!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gustavo Arriola

    #1

    Invoking Class from a variable string in VB 2005...!

    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(No do) 'Nodo = "infoInsumo ,
    infoInsumo" -->The assembly does not have root namespace
    Dim Clase As Object = Activator.Creat eInstance(Tipo,
    Reflection.Bind ingFlags.Create Instance)

    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



  • tommaso.gastaldi@uniroma1.it

    #2
    Re: Invoking Class from a variable string in VB 2005...!

    Make sure you have a reference to the DLL
    and that the class is public.

    Tommaso

    Gustavo Arriola ha scritto:
    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(No do) 'Nodo = "infoInsumo ,
    infoInsumo" -->The assembly does not have root namespace
    Dim Clase As Object = Activator.Creat eInstance(Tipo,
    Reflection.Bind ingFlags.Create Instance)
    >
    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

    Comment

    • Gustavo Arriola

      #3
      Re: Invoking Class from a variable string in VB 2005...!

      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


      Comment

      • tommaso.gastaldi@uniroma1.it

        #4
        Re: Invoking Class from a variable string in VB 2005...!

        Use fully qualified name of the Type:

        "YourClass, YourAssembly"

        (or
        "YourNamespace. YourClass, YourAssembly")

        can also use:
        objType.Assembl y.FullName.ToSt ring

        see:

        http://msdn.microsoft.com/library/de...dnametopic.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

        Comment

        • tommaso.gastaldi@uniroma1.it

          #5
          Re: Invoking Class from a variable string in VB 2005...!

          or also

          http://msdn.microsoft.com/library/de...lnametopic.asp

          tommaso.gastald i@uniroma1.it ha scritto:
          Use fully qualified name of the Type:
          >
          "YourClass, YourAssembly"
          >
          (or
          "YourNamespace. YourClass, YourAssembly")
          >
          can also use:
          objType.Assembl y.FullName.ToSt ring
          >
          see:
          >
          http://msdn.microsoft.com/library/de...dnametopic.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

          Comment

          Working...