Feb 14th, 2007, 12:06 PM
copy groupbox with childs from one tab to another
Hey, is there a way in vb.net 2005 express edition to copy a groupbox from a tab to a new tab.
I have a button on the first tab. This button creates a new tab, and copy a groupbox from the first tab to the other. In this groupbox there are textfields, labels, buttons,...
I should make as many tabs i want, and fill them in undepended of the other.
That because on the firsttab there is a datagridview with persons, when i click on a person he opens a tab with al the info in of this person. If i want to create a new person, i have the click on the button new, so ik can make a new person.
now i use this code, but when i make another tab, the groupbox isn't visible anymore.
Private Sub btnNewCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewCustomer.Click
Dim t As New TabPage
Dim g As New GroupBox
g = Me.grpCreateCustomer
g.Visible = True
t.Text = "new tabpage"
i hope you all understand it,
greetz and thanks, freakyme
VB.NET 2005 n00b
Feb 14th, 2007, 04:35 PM
Re: copy groupbox with childs from one tab to another
What you should do is inherit the TabPage class and add code to create all the controls you need on a page. You then create instances of this class and add them to your TabControl instead of vanilla TabPages. Now the work to create all the controls is encapsulated within the tab page itself and you don't have to concern yourself with that when you use one. That's what OOP is all about.
Click Here to Expand Forum to Full Width