I'm trying to add a tabPage to an existing TabControl named TabControl4 I went all over it with the Debugger and everything is fine, but it won't show the TabPage in the TabControl. That's the code, Notice all the information being added to the TabPage is retrieved from a database so don't pay any attention to it, plus the software is in Hebrew so just ignore the Hebrew Strings.
Table = DataBase.OpenRecordset("AthInj")
Table.Index = "PrimaryKey"
Table.Seek("=", AthId)
Dim day1() As String = Table.Fields("injDay1").Value.ToString.Split("^")
Dim month1() As String = Table.Fields("injMonth1").Value.ToString.Split("^")
Dim year1() As String = Table.Fields("injYear1").Value.ToString.Split("^")
Dim day2() As String = Table.Fields("injDay2").Value.ToString.Split("^")
Dim month2() As String = Table.Fields("injMonth2").Value.ToString.Split("^")
Dim year2() As String = Table.Fields("injYear2").Value.ToString.Split("^")
Dim injs() As String = Table.Fields("inj").Value.ToString.Split("$")
Dim treats() As String = Table.Fields("treat").Value.ToString.Split("$")
Dim rehabs() As String = Table.Fields("rehab").Value.ToString.Split("$")
For i As Integer = 0 To injs.Length - 2
Dim tp As New TabPage
tp.Text = "פציעה " & (i + 1)
tp.Name = "inj" & i
Dim bday1 As New ComboBox
Dim bmonth1 As New ComboBox
Dim byear1 As New ComboBox
Dim bday2 As New ComboBox
Dim bmonth2 As New ComboBox
Dim byear2 As New ComboBox
Dim da As Label
Dim label1 As Label
Dim label3 As Label
Dim label4 As Label
Dim multiText As New TextBox
Dim ill As New TextBox
Dim date2 As Label
Dim rehabText As New TextBox
da = setLabel("מתאריך:", "injda" & i, 17, 560)
label1 = setLabel("הפציעה/מחלה:", "inj" & i, 133, 490)
date2 = setLabel("עד לתאריך:", "date2" & i, 67, 560)
label3 = setLabel("דרכי הטיפול:", "injtreat" & i, 187, 473)
label4 = setLabel("דרכי השיקום:", "injrehab" & i, 326, 470)
copyCombo(bday2, bday, i, 60, bday.Width, 71)
copyCombo(bmonth2, bmonth, i, 230, bmonth.Width, 71)
copyCombo(byear2, byear, i, 396, byear.Width, 71)
bday2.Name = "bday2" & i
bmonth2.Name = "bmonth2" & i
byear2.Name = "byear2" & i
byear2.SelectedIndex = byear2.FindStringExact(year2(i))
bmonth2.SelectedIndex = month2(i)
bday2.SelectedIndex = day2(i)
copyCombo(bday1, bday, i, 60, bday.Width, da.Top + 4)
copyCombo(bmonth1, bmonth, i, 230, bmonth.Width, da.Top + 4)
copyCombo(byear1, byear, i, 396, byear.Width, da.Top + 4)
byear1.SelectedIndex = byear1.FindStringExact(year1(i))
bmonth1.SelectedIndex = month1(i)
bday1.SelectedIndex = day1(i)
setTextBox(ill, 138, 80, "ill" & i, False, ScrollBars.None, 400)
ill.Text = injs(i)
setTextBox(multiText, 191, 32, "treatText" & i, True, ScrollBars.Vertical, 399)
setTextBox(rehabText, 330, 32, "rehabText" & i, True, ScrollBars.Vertical, 399)
multilineToBox(treats(i), multiText)
multilineToBox(rehabs(i), rehabText)
With tp.Controls
.Add(rehabText)
.Add(ill)
.Add(date2)
.Add(bday2)
.Add(bmonth2)
.Add(byear2)
.Add(da)
.Add(label1)
.Add(label3)
.Add(label4)
.Add(bday1)
.Add(bmonth1)
.Add(byear1)
.Add(multiText)
End With
tp.AutoScroll = True
tp.BackColor = Color.White
tp.RightToLeft = Windows.Forms.RightToLeft.Yes
TabControl4.Controls.Add(tp)
Next