Noxious Posted January 25, 2010 Report Share Posted January 25, 2010 Greetings, I am trying to create a UI that can be used across many applications and am (thus far) unable to programmatically create/delete a new page on a tab control. Does anyone have any ideas on how to do this? Thanks in advance. Quote Link to comment
Francois Normandin Posted January 25, 2010 Report Share Posted January 25, 2010 Greetings, I am trying to create a UI that can be used across many applications and am (thus far) unable to programmatically create/delete a new page on a tab control. Does anyone have any ideas on how to do this? Thanks in advance. You cannot create tabs dynamically (at Runtime) because it needs recompiling the code. You can only do it at development time. If in Dev environment, then there is a method for Adding/Removing tabs. Search the forums to find the solutions proposed to get around this problem, it's been asked many times and based on your application, an alternative solution might already be out there waiting...Creating all your tabs beforehand and hiding some based on your different UIs is one of them. Quote Link to comment
JustinThomas Posted January 27, 2010 Report Share Posted January 27, 2010 (edited) It is not possible to create pages on the fly during runtime for a Tab Control. I generally do this kind of thing using a 'subpanel'. If you could post what you are trying to achieve people on the forum can give alternate suggestions Edited January 27, 2010 by JustinThomas Quote Link to comment
ScubaBob Posted February 23, 2010 Report Share Posted February 23, 2010 (edited) 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 Edited February 23, 2010 by ScubaBob Quote Link to comment
Mark Yedinak Posted February 23, 2010 Report Share Posted February 23, 2010 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 And this helps someone with LabVIEW in what way? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.