📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
BorderStyle = 1 'Fixed Single
Caption = "Form2"
ClientHeight = 5040
ClientLeft = 45
ClientTop = 435
ClientWidth = 4125
LinkTopic = "Form2"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 88.9
ScaleMode = 0 'User
ScaleWidth = 72.76
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "民族类别条目"
Height = 4815
Left = 120
TabIndex = 0
Top = 120
Width = 3975
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 2880
TabIndex = 9
Top = 4200
Width = 855
End
Begin VB.Frame Frame3
Caption = "提示"
Height = 2655
Left = 2520
TabIndex = 6
Top = 1200
Width = 1215
Begin VB.Label Label1
Caption = " 在新增资料对话框中输入要新的条目,按回车即可完成添加资料。"
Height = 1095
Left = 120
TabIndex = 7
Top = 240
Width = 975
End
Begin VB.Label Label2
Caption = " 选列表框中的条目点删除按钮即可以删除选中的条目!"
Height = 855
Left = 120
TabIndex = 8
Top = 1560
Width = 975
End
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 255
Left = 2880
TabIndex = 5
Top = 720
Width = 855
End
Begin VB.CommandButton Command1
Caption = "增加"
Height = 255
Left = 2880
TabIndex = 4
Top = 360
Width = 855
End
Begin VB.Frame Frame2
Caption = "这里输入你要添加的条目"
Height = 615
Left = 120
TabIndex = 2
Top = 4080
Width = 2535
Begin VB.TextBox Text1
Height = 270
Left = 120
TabIndex = 3
Top = 240
Width = 2295
End
End
Begin VB.ListBox List1
BackColor = &H00C0FFFF&
Height = 3480
Left = 120
TabIndex = 1
Top = 360
Width = 2175
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim NewName As String
Dim count As Integer
Dim i As Integer, n As Integer
NewName = Text1.Text
If NewName = "" Then
Dim a As Integer
a = MsgBox("请输入项目!", 48, "提示")
Text1.SetFocus
Exit Sub
Else
For i = 0 To List1.ListCount - 1
If NewName = List1.List(i) Then
a = MsgBox("已存在列表中!", 48, "提示")
Text1.SetFocus
Exit Sub
End If
Next i
count = GetPrivateProfileInt("民族", "类型数", _
0, App.Path + "\data\部门.ini")
count = count + 1
n = WritePrivateProfileString("民族", "类型数", _
Str(count), App.Path + "\data\部门.ini")
n = WritePrivateProfileString("民族", "b" & count, _
NewName, App.Path + "\data\部门.ini")
End If
List1.Clear
Dim Name As Long
count = GetPrivateProfileInt("民族", "类型数", 0, _
App.Path + "\data\部门.ini")
For i = 1 To count
List1.AddItem GetPrivateStringValue("民族", "b" & _
i, App.Path + "\data\部门.ini")
Next i
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
If List1.ListIndex >= 0 Then
Dim count As Integer
Dim i As Integer, n As Integer
count = GetPrivateProfileInt("民族", "类型数", 0, _
App.Path + "\data\部门.ini")
count = count - 1
n = WritePrivateProfileString("民族", "类型数", _
Str(count), App.Path + "\data\部门.ini")
n = WritePrivateProfileString("民族", "b" & _
count + 1, "", App.Path + "\data\部门.ini")
List1.Clear
Dim Name As Long
count = GetPrivateProfileInt("民族", "类型数", _
0, App.Path + "\data\部门.ini")
For i = 1 To count
List1.AddItem GetPrivateStringValue("民族", "b" & _
i, App.Path + "\data\部门.ini")
Next i
Else
Dim a As Integer
a = MsgBox("请选中要删除的项目!", 48, "提示")
End If
End Sub
Private Sub Command3_Click()
Form1.Combo3.Clear
Dim count As Integer
Dim Name As Long
Dim i As Integer, n As Integer
count = GetPrivateProfileInt("民族", "类型数", 0, _
App.Path + "\data\部门.ini")
For i = 1 To count
Form1.Combo3.AddItem GetPrivateStringValue("民族", _
"b" & i, App.Path + "\data\部门.ini")
Next i
Form1.Combo3.Text = GetPrivateStringValue("民族", "b1", App.Path + "\data\部门.ini")
Unload Me
End Sub
Private Sub Form_Load()
Dim count As Integer
Dim Name As Long
Dim i As Integer, n As Integer
count = GetPrivateProfileInt("民族", "类型数", 0, _
App.Path + "\data\部门.ini")
For i = 1 To count
List1.AddItem GetPrivateStringValue("民族", "b" & _
i, App.Path + "\data\部门.ini")
Next i
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -