📄 frmcity.frm
字号:
VERSION 5.00
Begin VB.Form frmCity
Caption = "城市与人口"
ClientHeight = 2835
ClientLeft = 60
ClientTop = 345
ClientWidth = 4980
LinkTopic = "Form1"
ScaleHeight = 2835
ScaleWidth = 4980
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdClear
Caption = "全部删除(&X)"
Height = 375
Left = 600
TabIndex = 8
Top = 2280
Width = 1335
End
Begin VB.CommandButton cmddelete
Caption = "删除(&D)<-"
Height = 375
Left = 600
TabIndex = 7
Top = 1800
Width = 1335
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)->"
Height = 375
Left = 600
TabIndex = 6
Top = 1320
Width = 1335
End
Begin VB.Frame fraCity
Caption = "已有城市(&S)"
Height = 2415
Left = 2640
TabIndex = 4
Top = 240
Width = 1935
Begin VB.ListBox lstCity
Height = 1860
Left = 240
TabIndex = 5
Top = 240
Width = 1455
End
End
Begin VB.TextBox txtPop
Height = 375
Left = 1200
TabIndex = 1
Top = 840
Width = 1095
End
Begin VB.TextBox txtCity
Height = 375
Left = 1200
TabIndex = 0
Top = 240
Width = 1095
End
Begin VB.Label lblPop
Caption = "人口数(&P)"
Height = 255
Left = 240
TabIndex = 3
Top = 960
Width = 855
End
Begin VB.Label lblCity
Caption = "城市名(&C)"
Height = 255
Left = 240
TabIndex = 2
Top = 360
Width = 855
End
End
Attribute VB_Name = "frmCity"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAdd_Click()
Dim strCity As String
Dim lngPop As Long
Dim int1 As Integer
strCity = CStr(txtCity.Text)
lngPop = CLng(txtPop.Text)
If strCity = "" Then Exit Sub
For int1 = 0 To lstCity.ListCount - 1
If strCity = lstCity.List(int1) Then
Exit Sub
End If
Next
lstCity.AddItem strCity
lstCity.ItemData(lstCity.NewIndex) = lngPop
txtCity.Text = ""
txtPop.Text = ""
End Sub
Private Sub cmdClear_Click()
lstCity.Clear
End Sub
Private Sub cmddelete_Click()
If lstCity.ListIndex > -1 Then
lstCity.RemoveItem lstCity.ListIndex
End If
End Sub
Private Sub lstCity_Click()
txtCity.Text = lstCity.List(lstCity.ListIndex)
txtPop.Text = lstCity.ItemData(lstCity.ListIndex)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -