【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了Form2.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form Form1
Caption = "ListBox(
列表框)"
ClientHeight = 4140
ClientLeft = 60
ClientTop = 345
ClientWidth = 4815
LinkTopic = "Form1"
ScaleHeight = 4140
ScaleWidth = 4815
StartUpPosition = 3 '窗口缺省
Begin VB.ListBox List2
Height = 690
Left = 240
Style = 1 'Checkbox
TabIndex = 5
Top = 2880
Width = 2175
End
Begin VB.ListBox List1
Height = 780
Left = 240
TabIndex = 4
Top = 840
Width = 1935
End
Begin VB.Label Label3
Caption = "label3"
Height = 735
Left = 2880
TabIndex = 3
Top = 840
Width = 1695
End
Begin VB.Label Label4
Caption = "Label4"
Height = 735
Left = 2880
TabIndex = 2
Top = 2760
Width = 1575
End
Begin
VB.Label Label2
Caption = "Style=1, CheckBox"
Height = 255
Left = 240
TabIndex = 1
Top = 2160
Width = 2175
End
Begin VB.Label Label1
Caption = "Style=0, Standard"
Height = 255
Left = 360
TabIndex = 0
Top = 360
Width = 1935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Label1_click()
List1.AddItem "January"
List1.AddItem "Febrary"
List1.AddItem "March"
List1.AddItem "April"
List1.AddItem "May"
List1.AddItem "June"
List1.AddItem "July"
List1.AddItem "Auguest"
List1.AddItem "September"
List1.AddItem "October"
List1.AddItem "November"
List1.AddItem "December"
End Sub
Private Sub label2_Click()
List2.AddItem "Spring"
List2.AddItem "Summer"
List2.AddItem "Autumn"
List2.AddItem "Winter"
End Sub
Private Sub Label3_dblClick()
List1.Clear
End Sub
Private Sub Label4_dblClick()
List2.Clear
End Sub
Private Sub List1_Click()
Label3.Caption = "This month is " & List1
End Sub
Private Sub List2_Click()
Label4.Caption = "This session is " & List2
End Sub
Private Sub label3_Click()
n = List1.ListIndex
If n > -1 Then List1.RemoveItem n
End Sub
Private Sub label4_Click()
n = List2.ListIndex
If n > -1 Then List2.RemoveItem n
End Sub