Multiple tabs question...

dualshock03

Well-known member
Joined
Jan 28, 2007
Messages
105
Programming Experience
1-3
I got this code of mine when adding tabs to my tabcontrol...

VB.NET:
 Private tabPages As New Stack(Of TabPage)
    Function _ADDTABS() As Object
        If tabPages.Count > 0 Then
            'Add the page at the top of the stack.
            TabControl1.TabPages.Add(tabPages.Pop())
        End If
        Return Nothing
    End Function

Private Sub addsheet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addsheet.Click
        _ADDTABS()
    End Sub

HOwever.. how will i remove tabs instead?? i got a button click which will allow me to remove certain tab..


=========================================================
My second question is about formatting the datetimepicker control... how can i manage to format a null value for my datetimepicker? because it seems there's no option for erasing the value of the datetimepicker... something this: datetimepicker.text = "" OR = nothing OR just even this format doesnt work.. = "0/00/0000"


any answers would be appreciated...
 
How to remove all tabs in a stack? remove each tab by a button except for the 1st tab.. i have 10 tabs and i want to remove them each, except for the 1st tab..
 
Call the Remove or RemoveAt method multiple times, or do this:
VB.NET:
Dim keep As TabPage = Me.TabControl1.TabPages(0)
Me.TabControl1.TabPages.Clear()
Me.TabControl1.TabPages.Add(keep)
 
tnx for the code.. but it seems it removes all the tabs, not by each.. im trying other ways but it seems when example i add tab 2 and 3 so it will be TAB1, 2, 3, then i click the remove button to remove tab 3 then return the tab 3 again by pressing the add button what happened was.. tab 4 is added instead of tab 3.. this is a stack process... it should be FILO right?
 
tnx for the code.. but it seems it removes all the tabs
No, it remove all except the first.
VB.NET:
it should be FILO right?
The index of tabpages is the order they were added, from 0 and up, unless you use Insert to set a different index obviously.
 
Back
Top