[RESOLVED] MDI Child on Tab of parent.
Hi,
I have 3 forms loading to memory in sub main()
The first form is "frm_Main". Which is the main form. The other two are "frm_1" and "frm_2" which are MDI children of frm_Main. All forms are loaded to memory "as New frm_OriginalForm" (whatever the original is) and the frm_XX name is accessible from any module or form in the project.
Currently, everything works, however I wish to place a tab control on "frm_Main" and put "frm_1" in tab index 0 and "frm_2" in tab index 2 so that these forms can be tabbed between by the user.
However, when I put the tab control on my "frm_Main" it covers up the two forms which are currently underneath it. Also, I have no idea where to go from here. Keep in mind that the two children forms are created in run time and are set to be the children in sub main.
Any help would be appreciated.
Best Regards,
Luc L.
Re: MDI Child on Tab of parent.
you can use the SetParent api to make the tabpage a parent of the child forms
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim f As New Form
f.Show()
SetParent(f.Handle.ToInt32, Me.TabPage1.Handle.ToInt32)
End Sub
hth
kevin
ps...
this only works if form child form runs in the same thread as the parent. Children can't be parented to controls on different threads
Re: MDI Child on Tab of parent.
thanks. that did the trick, though i was hoping for a non-api approach.