*TabControl*

Back to the start
Back to the libraries overview


Overview (TabControl)
AddControl (TabControl)
AddTabPage
Control (TabControl)
Height (TabControl)
Enabled (TabControl)
Left (TabControl)
New1 (TabControl)
PageCount
RemoveTabPage
SelectedIndex (TabControl)
SelectionChange (TabControl)
SetColor
SetText
Top (TabControl)
Visible (TabControl)
Width (TabControl)


Overview (TabControl) Top

TabControl can be used to fit more controls on the small screen area.
After creating the TabControl you can add existing controls to it using AddControl method.
The controls added would be removed from the form and will be added to the TabControl.

Example:(The use of AddButton and AddTextbox is not mandatory, it could be done using the Visual Designer also).

'First add a TabControl object named tbc via "Menu -> Tools -> Add Objects ".

Sub Globals

End Sub

Sub App_Start
Form1.Show
AddButton(Form1,"Button1",0,0,80,40,"Button1")
AddTextBox (Form1,"TextBox1",40,20,100,25,")
tbc.New1 ("Form1", 10,10, 200, 200)
tbc.AddTabPage("Page1")
tbc.AddTabPage("Page2")
tbc.AddTabPage("Page3")
tbc.AddControl("Button1",0,20,20)
tbc.AddControl("TextBox1",1,20,30)
End Sub


Sub tbc_SelectionChanged
msgbox("Selected page: " & tbc.SelectedIndex)
End Sub


AddControl (TabControl) Top

Adds an existing control to a page in the TabControl object.
Syntax: AddControl (ControlName As Control, PageIndex As Int32, Left As Int32, Top As Int32)

Note: The first page index is 0.
Example:
tbc.AddControl("Button1",0,20,20)


AddTabPage Top

Adds a new page to the TabControl object.
Syntax: AddTabPage (Text As String)
Text - The text that will appear on the page title.

Example:
tbc.AddTabPage("Page1")


Control (TabControl) Top

Gets or sets a reference to the control.
Syntax: Control


Enabled (TabControl) Top

Gets or sets whether the control is enabled.
Syntax: Enabled


Height (TabControl) Top

Gets or sets the height of the control.
Syntax: Height

Example:
tbc.Height = 100


Enabled (TabControl) Top

Gets or sets whether the control is enabled.
Syntax: Enabled

Example:
tbc.Enabled = true


Left (TabControl) Top

Gets or sets the Left proprty of the control.
Syntax: Left


New1 (TabControl) Top

Initializes the TabControl object.
Syntax: New1 (formName As Control, Left As Int32, Top As Int32m Width As Int32, Height As Int32)
formName - The name of the form (or panel) that will contain the TabControl.

Example:
tbc.New1("Form1",10,10,200,200)


PageCount Top

Returns the number of pages in the TabControl object.
Syntax: PageCount


RemoveTabPage Top

Removes a page from the TabControl object.
Syntax: RemoveTabPage( PageIndex As Int32)
The first page index is 0.


SelectedIndex (TabControl) Top

Gets or sets the index of the selected page.
Syntax: SelectedIndex
The first page index is 0.

Example:
tbc.SelectedIndex = 2 'The third page will appear


SelectionChange (TabControl) Top

Occurs whenever the selected page is changed.
Example:
Sub tbc_SelectionChanged
msgbox("Selected page: " & tbc.SelectedIndex)
End Sub


SetColor Top

Sets the back color of a page in the TabControl object.
Syntax: SetColor (TabPage As Int32, color As Color)
TabPage - The index of the page.


Example:
tbc.SetColor (0, cRed)


SetText Top

Changes the text of the specified page.
Syntax: SetText (TabPage As Int32, Text As String)

Example:
tbc.SetText (0,"New Name")


Top (TabControl) Top

Gets or sets the Top property of the control.
Syntax: Top


Visible (TabControl) Top

Gets or sets whether the control is visible.
Syntax: Visible


Width (TabControl) Top

Gets or sets the width of the control.
Syntax: Width