?? frmbackup.frm
字號:
VERSION 5.00
Begin VB.Form frmBackup
BorderStyle = 3 'Fixed Dialog
Caption = "備份數據庫"
ClientHeight = 3015
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 5220
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3015
ScaleWidth = 5220
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdBrowse
Caption = "瀏覽(&B)..."
Height = 435
Left = 2955
TabIndex = 5
Top = 885
Width = 1260
End
Begin VB.CheckBox chkPath
Caption = "選擇默認目錄(&M)"
Height = 195
Left = 165
TabIndex = 4
Top = 1005
Width = 2085
End
Begin VB.TextBox txtPath
Height = 270
Left = 150
TabIndex = 2
Top = 360
Width = 4740
End
Begin VB.CommandButton CancelCmd
Cancel = -1 'True
Caption = "取消(&C)"
Height = 435
Left = 2970
TabIndex = 1
Top = 2145
Width = 1260
End
Begin VB.CommandButton OKCmd
Caption = "確定(&O)"
Default = -1 'True
Height = 435
Left = 990
TabIndex = 0
Top = 2145
Width = 1260
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "選擇的備份目錄(&P):"
Height = 180
Left = 150
TabIndex = 3
Top = 120
Width = 1710
End
End
Attribute VB_Name = "frmBackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mPath As String '備份路徑
Private Sub CancelCmd_Click()
mPath = ""
Unload Me
End Sub
Private Sub chkPath_Click()
If chkPath.Value = 1 Then 'checked
txtPath.Enabled = False
txtPath = BK_PATH
txtPath.Enabled = False
cmdBrowse.Enabled = False
Else
txtPath.Enabled = True
txtPath.Enabled = True
cmdBrowse.Enabled = True
End If
End Sub
Private Sub cmdBrowse_Click()
Dim cjd As CJDFun.CFunction
On Error Resume Next
Set cjd = New CJDFun.CFunction
txtPath = cjd.BrowseForFolder(Me.hwnd)
If Not cjd Is Nothing Then
Set cjd = Nothing
End If
End Sub
'返回備份路徑
Public Property Get BackupPath() As String
BackupPath = mPath
End Property
Private Sub OKCmd_Click()
On Error Resume Next
Dim bSelected As Boolean
Dim fs As Scripting.FileSystemObject
Dim ret As VbMsgBoxResult
bSelected = False
If chkPath.Value = 1 Then 'checked
mPath = BK_PATH
bSelected = True
Else 'unchecked
Set fs = CreateObject("Scripting.FileSystemObject")
mPath = txtPath
If mPath = "" Then '如果沒有選擇路徑
MsgBox "請選擇備份路徑!", vbOKOnly + vbInformation, Me.Caption
Else
If Right(mPath, 1) <> "\" Then
mPath = mPath & "\"
End If
If mPath = DATABASE_PATH Then '與數據庫的路徑相同
mPath = mPath & "backup\"
bSelected = True
Else
'判斷是否所選目錄存在
If Not fs.FolderExists(mPath) Then '不存在
ret = MsgBox("你所輸入的備份路徑" & vbCrLf & mPath & vbCrLf & "不存在。" & vbCrLf & _
"確定要創建一個新的子目錄嗎?", vbOKCancel + vbQuestion, Me.Caption)
On Error GoTo ErrHandler
If ret = vbOK Then
Dim path As String
path = fs.GetParentFolderName(mPath)
fs.CreateFolder mPath
Else
Exit Sub
End If
End If
bSelected = True
End If
End If
End If
If bSelected Then
Unload Me
End If
Exit Sub
ErrHandler:
Dim msg As String
msg = Me.Name & ":OKCmd_Click()" & vbCrLf & vbCrLf & _
"錯誤#" & CStr(Err.Number) & ":子目錄無法創建!" & vbCrLf & vbCrLf & _
"原因可能是,你所選擇的目錄格式不正確" & vbCrLf & _
" 或者是選擇的子目錄的父目錄不存在。"
MsgBox msg, vbOKOnly + vbExclamation, Me.Caption
'寫入日志
WriteToLog (msg)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -