Link to home
Start Free TrialLog in
Avatar of Skale
Skale

asked on

Displaying specific project's form in solution for selected treeview node in vb.net

Hello,

I've similar topic before and find a solution with help of friends in following topic.

Displayin specific UserControl for selected node in vb.net
https://www.experts-exchange.com/questions/29142992/Displayin-specific-UserControl-for-selected-node-in-vb-net.html

Dim controls = GetType(GUI).Assembly.GetTypes.Where(Function(t) t.BaseType.Equals(GetType(UserControl)))
For Each element in treToolNavigation.Nodes.Cast(Of TreeNode)
    element.Tag = controls.FirstOrDefault(Function(t) t.Name.StartsWith(element.Text))
Next

Open in new window


And this is after node sleect event to show selected user control.

    Private Sub ToolNavigationAfterSelect(sender As Object, e As TreeViewEventArgs) Handles treToolNavigation.AfterSelect

        For Each ctrl As Control In IndexModuleTools.Panel2.Controls.Cast(Of Control).Reverse()
            ctrl.Dispose()
            IndexModuleTools.Panel2.Controls.Remove(ctrl)
        Next
        Dim dynType As Type = CType(e.Node.Tag, Type)
        Dim instance As Control = CType(Activator.CreateInstance(dynType), Control)
        instance.Dock = DockStyle.Fill
        IndexModuleTools.Panel2.Controls.Add(instance)
        instance.Show()
    End Sub

--- NOW --- i'd like to show Windows.Forms of another project which is included my solution but i don't know how it would be possible?

Any helps would be grateful.
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
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