Type.GetType with Two Project in one Solution

M

Mike Walters

I have Two Project in one Solution.
I am trying to use Type.GetType("string") 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.form1
from my MWDNav exe. But then I try to Get the Type of MWDBilling.form1
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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
addTabPage(Type.GetType("MWDBilling.Form1"))
End Sub

This Sub works
Private Sub MDIMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
addTabPage(Type.GetType("MWDNav.Form1"))
End Sub

Public Sub addTabPage(ByVal myType As Type)
Dim myForm As Object = System.Activator.CreateInstance(myType)
i_Filler_tc.ActiveLeaf.TabPages.Add(New TabPage("Main", CType(myForm,
Control)))
End Sub

This works
Private Sub MDIMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim test as new MWDBilling.form1
Test.show
End Sub
 
M

Mattias Sjögren

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
 
M

Mike Walters

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!
 
M

Mike Walters

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top