Type.GetType with Two Project in one Solution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Walters

    Type.GetType with Two Project in one Solution

    I have Two Project in one Solution.
    I am trying to use Type.GetType("s tring") to pass the "Type" to a Sub.
    Project one is MWDNav. Project two is MWDBilling. MWDNav is my exe.
    MWDBing is a Class Library that holds my forms. I am reference
    MWDBilling and I can create a "new" instance of my MWDBilling.form 1
    from my MWDNav exe. But then I try to Get the Type of MWDBilling.form 1
    from my MWDNav I get a myTpye Null error. I am looking for any
    suggestions.

    Thanks
    Mike Walters

    This Sub does not
    Private Sub MDIMain_Load(By Val sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    addTabPage(Type .GetType("MWDBi lling.Form1"))
    End Sub

    This Sub works
    Private Sub MDIMain_Load(By Val sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    addTabPage(Type .GetType("MWDNa v.Form1"))
    End Sub

    Public Sub addTabPage(ByVa l myType As Type)
    Dim myForm As Object = System.Activato r.CreateInstanc e(myType)
    i_Filler_tc.Act iveLeaf.TabPage s.Add(New TabPage("Main", CType(myForm,
    Control)))
    End Sub

    This works
    Private Sub MDIMain_Load(By Val sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    Dim test as new MWDBilling.form 1
    Test.show
    End Sub
  • Mattias Sjögren

    #2
    Re: Type.GetType with Two Project in one Solution

    Mike,

    Why are you using the Type.GetType method as opposed to VB's GetType
    operator? The reason Type.GetType fails is that you don't include the
    fully qualified type name (which includes the assembly name).



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Mike Walters

      #3
      Re: Type.GetType with Two Project in one Solution

      I tried what I think was the fully qualified type name, but it still did
      not work. How do I determine what it is?

      Thanks
      Mike



      *** Sent via Devdex http://www.devdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Jay B. Harlow [MVP - Outlook]

        #4
        Re: Type.GetType with Two Project in one Solution

        Mike,
        What specifically did you try, you need to use something like:

        addTabPage(Type .GetType("MWDBi lling.Form1, MWDBilling"))

        addTabPage(Type .GetType("MWDNa v.Form1, MWDNav"))

        The simpliest qualified type name is "mynamespace.my class, myassembly".

        For details on fully qualified type name see:



        Hope this helps
        Jay

        "Mike Walters" <mike@waltersce ntral.com> wrote in message
        news:eWCbeZiUEH A.1764@TK2MSFTN GP10.phx.gbl...[color=blue]
        > I tried what I think was the fully qualified type name, but it still did
        > not work. How do I determine what it is?
        >
        > Thanks
        > Mike
        >
        >
        >
        > *** Sent via Devdex http://www.devdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        • Mike Walters

          #5
          Re: Type.GetType with Two Project in one Solution

          YES, thank you vary much, I have never seen the "," and assemble used
          like that. You just saved me allot of time. I was just about to start
          looking at reflection.

          Thanks
          Mike





          *** Sent via Devdex http://www.devdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          Working...