📄 frmdbset.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmDBSet
BorderStyle = 3 'Fixed Dialog
Caption = "数据库设置"
ClientHeight = 3930
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
FillColor = &H80000009&
Icon = "frmDBSet.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3930
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame3
Caption = "学生信息条目(请慎用)"
Height = 1965
Left = 75
TabIndex = 7
Top = 1335
Width = 4485
Begin VB.TextBox txtItem
Height = 1650
Left = 105
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 8
Top = 210
Width = 4275
End
End
Begin VB.CommandButton Command4
Caption = "应用"
Enabled = 0 'False
Height = 330
Left = 3330
TabIndex = 6
Top = 3465
Width = 1200
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 330
Left = 2025
TabIndex = 5
Top = 3465
Width = 1200
End
Begin VB.CommandButton Command2
Caption = "确定"
Height = 330
Left = 705
TabIndex = 4
Top = 3465
Width = 1200
End
Begin MSComDlg.CommonDialog CDL
Left = 2280
Top = 585
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "数据库路径"
Height = 1125
Left = 90
TabIndex = 0
Top = 105
Width = 4485
Begin VB.CommandButton Command1
Caption = "更改..."
Height = 345
Left = 3375
TabIndex = 3
Top = 630
Width = 945
End
Begin VB.TextBox txtPath
Height = 270
Left = 1005
TabIndex = 2
Top = 270
Width = 3315
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "当前路径:"
Height = 180
Left = 120
TabIndex = 1
Top = 315
Width = 900
End
End
End
Attribute VB_Name = "frmDBSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
On Error GoTo erh '发生错误时跳转
With CDL
.Filter = "Microsoft Access(*.mdb)|*.mdb" '设置过滤器
.DialogTitle = "打开数据库文件" '设置窗口标题
.CancelError = True '取消引发错误
.ShowOpen
txtPath.Text = CDL.FileName
End With
erh:
End Sub
Private Sub Command2_Click()
Save
Hide
End Sub
Private Sub Command3_Click()
Hide
End Sub
Private Sub Command4_Click()
Save
Command4.Enabled = False
End Sub
Sub Save()
Dim i As New IniClass
i.INIFileName = App.Path & "\ini.ini"
i.WriteIniKeyEx "DBSET", "Path", txtPath.Text
i.WriteIniKeyEx "Items", "InfoItems", txtItem.Text
frmMain.InitDB
Set i = Nothing
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim i As New IniClass
i.INIFileName = App.Path & "\ini.ini"
txtPath.Text = i.GetIniKey("DBSET", "Path")
txtItem.Text = i.GetIniKey("Items", "InfoItems")
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Not UnloadMode Then Cancel = 1
End Sub
Private Sub txtItem_KeyPress(KeyAscii As Integer)
If Not txtItem.BackColor = vbRed Then txtItem.BackColor = vbRed
If KeyAscii = vbKeyReturn Then KeyAscii = 0
End Sub
Private Sub txtPath_Change()
If Not Command4.Enabled Then Command4.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -