-
Feb 14th, 2007, 01:06 PM
#1
Thread Starter
Lively Member
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.
More specefiek:
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.
VB Code:
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
Me.tabTabcontrol1.TabPages.Add(t)
t.Text = "new tabpage"
t.Controls.Add(g)
End Sub
i hope you all understand it,
greetz and thanks, freakyme
VB.NET 2005 n00b
-
Feb 14th, 2007, 05:35 PM
#2
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|