Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
NewTab(TextBox1.Text)
End Sub
Sub NewTab(Optional tabname As String = "New Tab")
Dim dpk As New System.Windows.Forms.DateTimePicker
dpk.Location = New System.Drawing.Point(36, 46)
dpk.Name = "DateTimePicker1"
dpk.Size = New System.Drawing.Size(200, 20)
Dim tab As New System.Windows.Forms.TabPage
With tab
.Controls.Add(dpk)
.Location = New System.Drawing.Point(4, 22)
.Text = tabname
.UseVisualStyleBackColor = True
End With
Me.TabControl1.Controls.Add(tab)
End Sub