📄 select_db.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Select_DB
BorderStyle = 1 'Fixed Single
Caption = "选择数据库路径"
ClientHeight = 615
ClientLeft = 45
ClientTop = 435
ClientWidth = 9885
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 615
ScaleWidth = 9885
StartUpPosition = 2 '屏幕中心
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3960
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton cmdOK
Caption = "确认"
Height = 375
Left = 9000
TabIndex = 3
Top = 120
Width = 800
End
Begin VB.CommandButton cmdSelect
Caption = "选择"
Height = 375
Left = 8160
TabIndex = 2
Top = 120
Width = 800
End
Begin VB.TextBox DB_Path
Height = 375
Left = 1440
TabIndex = 1
Top = 120
Width = 6615
End
Begin VB.Label Label1
Caption = "请选择数据库"
Height = 255
Left = 120
TabIndex = 0
Top = 150
Width = 1215
End
End
Attribute VB_Name = "Select_DB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private FilePath As String
Private Fs As New FileSystemObject
Private TempFile As TextStream
Private Sub cmdOK_Click()
If DB_Path.Text <> "" Then
DataBasePath = DB_Path.Text
Unload Me
Sys_Login.Show
Else
MsgBox "未选择数据库", vbExclamation, "警告"
End If
End Sub
Private Sub cmdSelect_Click()
Call OpenFile
If CommonDialog1.FileTitle = "Client_DB.mdb" Then
DB_Path.Text = FilePath
Set TempFile = Fs.OpenTextFile(App.Path & "\DP.txt", ForWriting)
TempFile.Write DB_Path.Text
TempFile.Close
Else
MsgBox "非法数据库,本程序数据库为Client_DB.mdb", vbExclamation, "警告"
End If
End Sub
Private Sub Form_Load()
Set TempFile = Fs.OpenTextFile(App.Path & "\DP.txt", ForReading)
If Not TempFile.AtEndOfLine Then
DB_Path.Text = TempFile.ReadLine
End If
TempFile.Close
End Sub
'打开文件
Private Sub OpenFile()
CommonDialog1.ShowOpen
On Error GoTo err
FilePath = CommonDialog1.FileName
Exit Sub
err:
MsgBox "没有选定的文件,请重试", vbInformation, "信息提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -