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.
Page 1 of 1
Programmatically create new page in tab control?
#2
Posted 25 January 2010 - 08:02 PM
Noxious, on 25 January 2010 - 02:49 PM, said:
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.
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.
François [frɑ̃swa]
#3
Posted 27 January 2010 - 05:39 AM
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
This post has been edited by JustinThomas: 27 January 2010 - 05:40 AM
#4
Posted 23 February 2010 - 03:20 AM
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
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
This post has been edited by ScubaBob: 23 February 2010 - 03:44 AM
#5
Posted 23 February 2010 - 06:18 PM
ScubaBob, on 22 February 2010 - 09:20 PM, said:
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
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?
---
Mark Yedinak - Certified LabVIEW Architect
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Mark Yedinak - Certified LabVIEW Architect
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Share this topic:
Page 1 of 1

Help

Back to top
MultiQuote











