Problems with Padding

ironfistchamp

Active member
Joined
Dec 9, 2005
Messages
29
Programming Experience
Beginner
Hi people another problem with my tabbed program.

Here we go. I have a tab control that has tabs created dynamically. It automatically starts with one tab that has a rtb (rich text box in it). I have the padding set to 3 all around it. That works fine as the rtb (dockstyle.fill) has a small bit of grey around it which looks good. However all tab pages that are created dynamically dont seem to have any padding even though I specify that it should have. I have ried different coding methods and rearranging the code.

I really don't know how I can get it so the new tabs have padding. Can anyone help. Maybe there is some way I can copy all the propeties from the original tab (barring name and other unique properties).

Anyone?

Thanks

Ironfistchamp
 
for each new dynamically added TabPage (tp) set the DockPadding property:
VB.NET:
tp.DockPadding.All = 3
 
Below is the complete code I used for testing, it adds 2 tabpages to an existing TabControl, each page is added a RichTextBox set DockStyle.Fill. Padding is working just fine here:
VB.NET:
Sub dynamictabpages()
  Dim tp As New TabPage
  tp.DockPadding.All = 10
  tp.BackColor = Color.Turquoise
  Dim rtb As New RichTextBox
  rtb.Dock = DockStyle.Fill
  tp.Controls.Add(rtb)
  TabControl1.[SIZE=2]TabPages[/SIZE].Add(tp)
 
  tp = New TabPage
  tp.DockPadding.All = 10
  tp.BackColor = Color.Blue
  rtb = New RichTextBox
  rtb.Dock = DockStyle.Fill
  tp.Controls.Add(rtb)
  TabControl1.[SIZE=2]TabPages[/SIZE].Add(tp)
End Sub
 
Last edited:
Thanks for the help. Now this is going to sound really really stupid but DockPadding is not on the list anymore. I just have dockpaddingedges.

My new tab is called tab so when i try and type

tab.dockpadding

It changes it to

tab.dockpaddingedges

Whats going on. Can someone help?

Thanks
 
Back
Top