Report Programmatically create new page in tab control? in User Interface Posted February 23, 2010 · Edited February 23, 2010 by ScubaBob Here is what i have come up with for creating tabcontrol and pages at runtime in vb2005 Dim i As Integer Dim temp As TabControl() = New TabControl(1) {} Dim SComp2 As String() = Nothing Dim CNT As Integer = 0 temp(CNT) = New TabControl temp(CNT).Name = sString(3) temp(CNT).Location = New System.Drawing.Point(Val(sString(5)), Val(sString(6))) temp(CNT).Size = New System.Drawing.Size(Val(sString(7)), Val(sString(8))) temp(CNT).Tag = Val(sString(2)) 'temp(CNT).TextAlign = ContentAlignment.MiddleCenter 'temp(CNT).ForeColor = System.Drawing.Color.Black 'temp(CNT).BackColor = System.Drawing.Color.LightSalmon SComp2 = sString(4).Split(";") For i = 0 To SComp2.GetUpperBound(0) temp(CNT).TabPages.Add(SComp2(i)) Next i For Each ctrl As Control In SplitContainer1.Panel1.Controls If TypeOf ctrl Is GroupBox Then If CType(ctrl, GroupBox).Tag = Val(sString(1)) Then CType(ctrl, GroupBox).Controls.Add(temp(CNT)) End If End If Next
Programmatically create new page in tab control?
in User Interface
Posted · Edited by ScubaBob
Here is what i have come up with for creating tabcontrol and pages at runtime in vb2005
Dim i As Integer
Dim temp As TabControl() = New TabControl(1) {}
Dim SComp2 As String() = Nothing
Dim CNT As Integer = 0
temp(CNT) = New TabControl
temp(CNT).Name = sString(3)
temp(CNT).Location = New System.Drawing.Point(Val(sString(5)), Val(sString(6)))
temp(CNT).Size = New System.Drawing.Size(Val(sString(7)), Val(sString(8)))
temp(CNT).Tag = Val(sString(2))
'temp(CNT).TextAlign = ContentAlignment.MiddleCenter
'temp(CNT).ForeColor = System.Drawing.Color.Black
'temp(CNT).BackColor = System.Drawing.Color.LightSalmon
SComp2 = sString(4).Split(";")
For i = 0 To SComp2.GetUpperBound(0)
temp(CNT).TabPages.Add(SComp2(i))
Next i
For Each ctrl As Control In SplitContainer1.Panel1.Controls
If TypeOf ctrl Is GroupBox Then
If CType(ctrl, GroupBox).Tag = Val(sString(1)) Then
CType(ctrl, GroupBox).Controls.Add(temp(CNT))
End If
End If
Next