I have set-up a tab control and have buttons set up to add and remove the tabs.
I want to place a text box into all the tabs, so when a new tab is added a text box is already placed inside the tab. I am not sure on how I would do this.

Dim myTabPage0 As New TabPage()
        myTabPage0.Text = "Event " & (TabControl1.TabPages.Count + 1)
        TabControl1.TabPages.Add(myTabPage0)

This is the code I am using to create the new tab could it be edited to allow for a textbox to be added.

Dim myTabPage0 As New TabPage()
        myTabPage0.Text = "Event " & (TabControl1.TabPages.Count + 1)
        TabControl1.TabPages.Add(myTabPage0)
        Dim txt As New TextBox
        txt.Text = "Test"
        myTabPage0.Controls.Add(txt)

Try if this helps u

This should do what you need it to do:

Dim myTabPage0 As New TabPage()
myTabPage0.Text = "Event " & (TabControl1.TabPages.Count + 1)
TabControl1.TabPages.Add(myTabPage0)
Dim txtBox As New TextBox
myTabPage0.Controls.Add(txtBox)

Also, you can choose the TextBox's location by a simple line of code like so:

TextBox1.Location=New Point(100,50)

This way you will have the TextBox be in a set location after each creation. Kind of makes it look more professional and less sloppy. You can also make the size different like so:

TextBox1.Size=New Size(75,23)
This question has already been answered. Start a new discussion instead.