📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "键的数据"
ClientHeight = 2616
ClientLeft = 4476
ClientTop = 3408
ClientWidth = 3684
LinkTopic = "Form2"
ScaleHeight = 2616
ScaleWidth = 3684
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 612
Left = 1800
TabIndex = 4
Top = 1920
Width = 1332
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 612
Left = 360
TabIndex = 3
Top = 1920
Width = 1332
End
Begin VB.Frame Frame1
Caption = "键的数据"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1812
Left = 0
TabIndex = 5
Top = 0
Width = 3612
Begin VB.TextBox sectionTxt
Height = 372
Left = 1320
TabIndex = 0
Top = 360
Width = 2052
End
Begin VB.TextBox keyTxt
Height = 372
Left = 1320
TabIndex = 1
Top = 840
Width = 2052
End
Begin VB.TextBox keyvalTxt
Height = 372
Left = 1320
TabIndex = 2
Top = 1320
Width = 2052
End
Begin VB.Label sectionLab
Caption = "扇区名称:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 240
TabIndex = 8
Top = 360
Width = 1212
End
Begin VB.Label keyLab
Caption = "键的名称:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 240
TabIndex = 7
Top = 840
Width = 1212
End
Begin VB.Label keyvalLab
Caption = "键的数值:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 240
TabIndex = 6
Top = 1320
Width = 1212
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()
If Flag = 0 Then
If Not Trim(sectionTxt) = "" And Not Trim(keyTxt) = "" Then
If SectionExists(FileName, sectionTxt) Then
If KeyExists(FileName, sectionTxt, keyTxt) Then
MsgBox sectionTxt & "扇区中的" & keyTxt & "的数值为" & GetKeyVal(FileName, sectionTxt, keyTxt), vbOKOnly, "键的数值"
Unload Me
Else
MsgBox keyTxt & "不存在!", vbOKOnly, "警告"
keyTxt.SetFocus
End If
Else
MsgBox sectionTxt & "不存在!", vbOKOnly, "警告"
sectionTxt.SetFocus
End If
Else
MsgBox "请输入数据完全!", vbOKOnly, "警告"
End If
End If
If Flag = 1 Then
If Not Trim(sectionTxt) = "" And Not Trim(keyTxt) = "" And Not Trim(keyvalTxt) = "" Then
If SectionExists(FileName, sectionTxt) Then
a = AddToINI(FileName, sectionTxt, keyTxt, keyvalTxt)
MsgBox sectionTxt & "扇区中的" & keyTxt & "的数值为" & GetKeyVal(FileName, sectionTxt, keyTxt), vbOKOnly, "键的数值"
Unload Me
Else
MsgBox sectionTxt & "不存在!", vbOKOnly, "警告"
sectionTxt.SetFocus
End If
Else
MsgBox "请输入数据完全!", vbOKOnly, "警告"
End If
End If
If Flag = 2 Then
If Not Trim(sectionTxt) = "" Then
If SectionExists(FileName, sectionTxt) Then
a = DeleteSection(FileName, sectionTxt)
MsgBox sectionTxt & "扇区已经被删除!", vbOKOnly, "删除扇区"
Unload Me
Else
MsgBox sectionTxt & "不存在!", vbOKOnly, "警告"
sectionTxt.SetFocus
End If
Else
MsgBox "请输入数据完全!", vbOKOnly, "警告"
End If
End If
If Flag = 3 Then
If Not Trim(sectionTxt) = "" And Not Trim(keyTxt) = "" Then
If SectionExists(FileName, sectionTxt) Then
If KeyExists(FileName, sectionTxt, keyTxt) Then
a = DeleteKey(FileName, sectionTxt, keyTxt)
MsgBox sectionTxt & "扇区中的" & keyTxt & "已经被删除!", vbOKOnly, "删除键"
Unload Me
Else
MsgBox keyTxt & "不存在!", vbOKOnly, "警告"
keyTxt.SetFocus
End If
Else
MsgBox sectionTxt & "不存在!", vbOKOnly, "警告"
sectionTxt.SetFocus
End If
Else
MsgBox "请输入数据完全!", vbOKOnly, "警告"
End If
End If
If Flag = 4 Then
If Not Trim(sectionTxt) = "" And Not Trim(keyTxt) = "" Then
If SectionExists(FileName, sectionTxt) Then
If KeyExists(FileName, sectionTxt, keyTxt) Then
a = DeleteKeyValue(FileName, sectionTxt, keyTxt)
MsgBox sectionTxt & "扇区中的" & keyTxt & "的数值已经被删除!", vbOKOnly, "删除键"
Unload Me
Else
MsgBox keyTxt & "不存在!", vbOKOnly, "警告"
keyTxt.SetFocus
End If
Else
MsgBox sectionTxt & "不存在!", vbOKOnly, "警告"
sectionTxt.SetFocus
End If
Else
MsgBox "请输入数据完全!", vbOKOnly, "警告"
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
If Flag = 0 Then
keyvalLab.Visible = False
keyvalTxt.Visible = False
Frame1.Height = 1300
Command1.Top = Frame1.Top + Frame1.Height + 120
Command2.Top = Frame1.Top + Frame1.Height + 120
Form2.Height = Command2.Top + Command2.Height + 520
End If
If Flag = 1 Then
End If
If Flag = 2 Then
keyvalLab.Visible = False
keyvalTxt.Visible = False
keyLab.Visible = False
keyTxt.Visible = False
Frame1.Height = 900
Command1.Top = Frame1.Top + Frame1.Height + 120
Command2.Top = Frame1.Top + Frame1.Height + 120
Form2.Height = Command2.Top + Command2.Height + 520
End If
If Flag = 3 Then
keyvalLab.Visible = False
keyvalTxt.Visible = False
Frame1.Height = 1300
Command1.Top = Frame1.Top + Frame1.Height + 120
Command2.Top = Frame1.Top + Frame1.Height + 120
Form2.Height = Command2.Top + Command2.Height + 520
End If
If Flag = 4 Then
keyvalLab.Visible = False
keyvalTxt.Visible = False
Frame1.Height = 1300
Command1.Top = Frame1.Top + Frame1.Height + 120
Command2.Top = Frame1.Top + Frame1.Height + 120
Form2.Height = Command2.Top + Command2.Height + 520
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -