Advertisement
2002ASP Complete Applications #557

Tabstrip project

This is a tabstrip project. By using an array, you can decide which tab container should be shown. Whatever you want to show when that tab is clicked goes into a container. I searched for months trying to learn about tabstrips and I hope this code helps someone else out.

AI

Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kaynak Kod
original-source
For this project you will need:
1 Form - People
1 Command button - cmdexit
1 TabStrip - TabStrip1 (default)
 Place 4 tabs onto the tabstrip
4 Pictureboxes (in an array)
 A) Picture1(1)
 B) Picture1(2)
 C) Picture1(3)
 D) Picture1(4)
 
Const Numtabs = 4 'Set the number of tabs
Dim x as Integer
 
'''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub cmdexit_Click()
 Unload People
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Form_Load()
 On Error Resume Next
 People.Height = 3375 'Set the size of your form
 People.Width = 4900
 For x = 1 To Numtabs 'Loop through the tabs
 With Picture1(x)
 .BorderStyle = 0
 .Left = TabStrip1.ClientLeft
 .Top = TabStrip1.ClientTop
 .Width = TabStrip1.ClientWidth
 .Height = TabStrip1.ClientHeight
 .Visible = False
 End With
 Next x
 TabStrip1.Tabs(1).Selected = True 'Form loads with first tab selected
 Picture1(TabStrip1.SelectedItem.Index).Visible = True 'Show first container
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub TabStrip1_Click()
 'This procedure determines which tab is selected
 'and what tab container should be shown
 
 Static PrevTab As Integer
 PrevTab = Switch(PrevTab = 0, 1, PrevTab >= 1 And PrevTab <= Numtabs, PrevTab)
 Picture1(PrevTab).Visible = False
 Picture1(TabStrip1.SelectedItem.Index).Visible = True
 Picture1(TabStrip1.SelectedItem.Index).Refresh
 PrevTab = TabStrip1.SelectedItem.Index
End Sub
'If you have any questions or problems, contact me:
'[email protected]
'http://home.earthlink.net/~zombiehead/vbexamples.htm

Upload
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı