Link to home
Start Free TrialLog in
Avatar of ardixiv
ardixiv

asked on

copying tabpage and all its items

hi all,

I have a tabpage with several labels and textboxes, which are filled by results of a MySql-query.  
For each row of the result of that query I need to create another tabpage, with the same characteristics as the first one.

thanks in advance
ardixiv
Avatar of RobertRFreeman
RobertRFreeman
Flag of United States of America image

Create a usercontrol that has all your tab elements on it.

dim row as datarow
Dim tp as System.Windows.Forms.TabPage
Dim uc as MyTabPageUserControl
for each row in dataset1.mytablename
     tp = New System.Windows.Forms.TabPage
     uc = New MyTabPageUserControl
     uc.TextBox1.Text = "test"
     tp.controls.add(uc)
     uc.dock =  = System.Windows.Forms.DockStyle.Fill
     Me.TabControl1.Me.TabControl1.TabPages.Add(tp)
next

For databinding/adapter info:
http://vsnetdatabinding.blogspot.com/
ASKER CERTIFIED SOLUTION
Avatar of RobertRFreeman
RobertRFreeman
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