📄 frmconfigdatasource.frm
字号:
VERSION 5.00
Begin VB.Form frmConfigDataSource
BackColor = &H00FF80FF&
BorderStyle = 3 'Fixed Dialog
Caption = "系统数据库配置"
ClientHeight = 2415
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 6150
Icon = "frmConfigDataSource.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 161
ScaleMode = 3 'Pixel
ScaleWidth = 410
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdExit
BackColor = &H00FF80FF&
Caption = "退出[&E]"
Height = 375
Left = 3120
Style = 1 'Graphical
TabIndex = 7
Top = 1560
Width = 1095
End
Begin VB.CommandButton cmdConfigure
BackColor = &H00FF80FF&
Caption = "配置[&C]"
Height = 375
Left = 1440
Style = 1 'Graphical
TabIndex = 6
Top = 1560
Width = 1095
End
Begin VB.TextBox txtDatabaseName
Height = 285
Left = 1440
TabIndex = 4
Top = 960
Width = 2775
End
Begin VB.TextBox txtDataBasePath
Height = 285
Left = 1440
TabIndex = 1
Top = 360
Width = 2775
End
Begin VB.CommandButton cmdBrowseB
BackColor = &H00FF80FF&
Caption = "选择[&L]..."
Height = 375
Left = 4440
Style = 1 'Graphical
TabIndex = 5
Top = 960
Width = 1095
End
Begin VB.CommandButton cmdBrowseA
BackColor = &H00FF80FF&
Caption = "选择[&S]..."
Height = 375
Left = 4440
Style = 1 'Graphical
TabIndex = 2
Top = 360
Width = 1095
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数据库名称:"
Height = 180
Index = 1
Left = 240
TabIndex = 3
Top = 960
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数据库路径:"
Height = 180
Index = 0
Left = 240
TabIndex = 0
Top = 360
Width = 1080
End
End
Attribute VB_Name = "frmConfigDataSource"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim bConfigSuccess As Boolean
Private Sub Form_Load()
'裝載字體設置
frmConfigDataSource_CharacterShow
End Sub
Private Sub cmdBrowseA_Click()
txtDataBasePath.Text = GetBrowseNetworkShare(Me.hwnd, False, True)
End Sub
Private Sub cmdBrowseB_Click()
txtDatabaseName.Text = GetRightStrFromString(OpenFile(Me.hwnd), "\")
End Sub
Private Sub cmdConfigure_Click()
If (Len(txtDataBasePath.Text) > 0) And _
(Len(txtDatabaseName.Text) > 0) Then
'配置數據源
bConfigSuccess = False
If ConfigDataSource(txtDataBasePath.Text, _
txtDatabaseName.Text) Then
bConfigSuccess = True '數據源配置成功
Unload Me '配置成功就御载窗体
Else
MsgBox "數據源配置失敗", vbExclamation, "錯誤"
End If
Else
MsgBox "請輸入或選擇數據庫路徑和名稱", vbExclamation, "提醒"
End If
End Sub
Private Function GetRightStrFromString( _
ByVal strCheck As String, _
ByVal strFindChar As String) As String
Dim lPos As Long
strCheck = Trim$(strCheck)
lPos = InStrRev(strCheck, strFindChar, -1, vbBinaryCompare)
GetRightStrFromString = Right$(strCheck, Len(strCheck) - lPos)
End Function
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
'數據源配置成功,則调用Main过程进行系统重新登录
If bConfigSuccess = True Then
Call Main '繫統登錄入口
End If
End Sub
Private Sub Form_Terminate()
On Error Resume Next
Set frmConfigDataSource = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -