OK so I am using a similar method to jmcilhinney's tabbed webbroser control to programmatically add tabpages with controls in them to a tabcontrol. All is going fine apart from the fact that whenever I set the Anchor property on a control, it makes the control extend past the bounds of the tabcontrol for some reason.

Here's the code I am using to add a label and a textbox to a new tabpage:

Code:
Public Class customertabpage
    Inherits System.Windows.Forms.TabPage

    Private _Namelbl As New KryptonLabel
    Private _NameBox As New KryptonTextBox
    Private testlbl As New Label
    Private testbox As New TextBox

        Public Sub New()
        customercount += 1
        testlbl.Location = New Point(0, 10)
        testlbl.Text = "Test Label"
        testlbl.Size = New Size(45, 20)

        testbox.Location = New Point(96, 7)
        testbox.Name = "testbox" & customercount
        testbox.Size = New Size(Form1.CustomerTabs.Width - 114, 20)
        testbox.Anchor = AnchorStyles.Left + AnchorStyles.Right + AnchorStyles.Top


        Me.Controls.Add(testlbl)
        Me.Controls.Add(testbox)
End Sub
End Class
The label and the text box get added to the correct locations, but the text box stretches out beyond the bounds of the tabcontrol and I cant figure out why. Do you have to tell it somehow which control it needs to 'anchor' itself to? (i.e the tabcontrol ) or anything like that?
If I take the Anchor line of code out then it works fine (but obviously doesnt resize automatically with the form, which is what I am trying to do)


Cheers
Chris