Link to home
Start Free TrialLog in
Avatar of sexy-sx
sexy-sx

asked on

GetType of a form in another assembly

Hi Experts,

I'm trying to load a form inside a tab page control.
I can do so if the form exists in the current project by using the following code.

Imports System.Reflection

Private Sub LoadTabForm(ByVal FormName As String)

        Dim frmTabForm As Form
        Dim tpType As Type

        tpType = Type.GetType(FormName)
        frmTabForm = Activator.CreateInstance(tpType)
       
        frmTabForm.TopLevel = False
        FormTabControl.TabPages(TabIndex).Controls.Add(frmTabForm)
        frmTabForm.FormBorderStyle = FormBorderStyle.None
        frmTabForm.Dock = DockStyle.Fill
        frmTabForm.Show()

End Sub

I'd like to call a form from another project in the same solution.
When i try it, it can't find it. Even giving it the full path.

Thanks,

Avatar of sexy-sx
sexy-sx

ASKER

That's ok, i found it.

For the form name, you must type in the whole path & form name.
e.g.

Main.UI.Form.MainForm, Main.UI.Form

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial