📄 例5.18.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3015
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3015
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 7
Top = 1680
Width = 690
End
Begin VB.CommandButton Command4
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 5
Top = 2400
Width = 855
End
Begin VB.CommandButton Command3
Caption = "全清"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3240
TabIndex = 4
Top = 1680
Width = 855
End
Begin VB.CommandButton Command2
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3240
TabIndex = 3
Top = 960
Width = 855
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 480
TabIndex = 0
Text = "Combo1"
Top = 480
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "添加"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3240
TabIndex = 2
Top = 240
Width = 855
End
Begin VB.Label Label1
Caption = "选修课程总数"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 6
Top = 1320
Width = 1455
End
Begin VB.Label Label2
Caption = "选修课程"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 1
Top = 120
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Combo1.AddItem "电子商务"
Combo1.AddItem "网页制作"
Combo1.AddItem "Internet简明教程"
Combo1.AddItem "计算机网络基础"
Combo1.AddItem "多媒体技术"
Combo1.Text = "" '置空值
Text1.Text = Combo1.ListCount '表项个数
End Sub
Private Sub command1_click() '“添加”
If Len(Combo1.Text) > 0 Then
Combo1.AddItem Combo1.Text
Text1.Text = Combo1.ListCount
End If
Combo1.Text = ""
Combo1.SetFocus '设置焦点
End Sub
Private Sub command2_click() '“删除”
Dim ind As Integer
ind = Combo1.ListIndex
If ind <> -1 Then '-1表示无表项
Combo1.RemoveItem ind '删除已选定的表项
Text1.Text = Combo1.ListCount
End If
End Sub
Private Sub command3_click() '“全清”
Combo1.Clear
Text1.Text = Combo1.ListCount
End Sub
Private Sub command4_click() '“退出”
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -