?? main_xtwh_sjbf.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form main_xtwh_sjbf
BorderStyle = 1 'Fixed Single
Caption = "系統(tǒng)維護-【數據備份】"
ClientHeight = 4950
ClientLeft = 45
ClientTop = 330
ClientWidth = 7995
Icon = "main_xtwh_sjbf.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4950
ScaleWidth = 7995
StartUpPosition = 1 '所有者中心
Begin VB.OptionButton Option2
Caption = "數據恢復"
Height = 270
Left = 5730
TabIndex = 10
Top = 90
Width = 1935
End
Begin VB.OptionButton Option1
Caption = "數據備份"
Height = 270
Left = 4065
TabIndex = 9
Top = 90
Value = -1 'True
Width = 1935
End
Begin VB.Frame Frame2
BackColor = &H00C0C0C0&
Caption = "請選擇數據庫文件"
Height = 3540
Left = 4020
TabIndex = 4
Top = 465
Width = 3915
Begin VB.DriveListBox Drive1
Height = 300
Left = 150
TabIndex = 7
Top = 255
Width = 3615
End
Begin VB.DirListBox Dir1
Height = 720
Left = 150
TabIndex = 6
Top = 630
Width = 3615
End
Begin VB.FileListBox File1
DragIcon = "main_xtwh_sjbf.frx":000C
Height = 2070
Left = 150
Pattern = "*.BAK;*.mdb"
TabIndex = 5
Top = 1380
Width = 3615
End
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "備份卡列表"
Height = 3540
Left = 45
TabIndex = 2
Top = 465
Width = 3915
Begin MSComctlLib.ListView ListView1
Height = 3180
Left = 105
TabIndex = 3
Top = 240
Width = 3690
_ExtentX = 6509
_ExtentY = 5609
Sorted = -1 'True
LabelWrap = -1 'True
HideSelection = -1 'True
AllowReorder = -1 'True
_Version = 393217
Icons = "ImageList1"
SmallIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
End
Begin VB.CommandButton Command2
Caption = "&E 退出"
Height = 420
Left = 3975
TabIndex = 1
Top = 4470
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "數據備份或數據恢復"
Height = 420
Left = 1800
TabIndex = 0
Top = 4470
Width = 2175
End
Begin MSComctlLib.ImageList ImageList1
Left = -135
Top = 1155
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_xtwh_sjbf.frx":044E
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_xtwh_sjbf.frx":0D2A
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_xtwh_sjbf.frx":1606
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "main_xtwh_sjbf.frx":1EE2
Key = ""
EndProperty
EndProperty
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "※ 請選擇數據備份或數據恢復"
ForeColor = &H000000FF&
Height = 210
Left = 135
TabIndex = 11
Top = 105
Width = 3030
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 420
Left = 75
TabIndex = 8
Top = 4050
Width = 7890
End
End
Attribute VB_Name = "main_xtwh_sjbf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX, key As String '聲明字符串變量
Dim a As Integer '聲明整型變量
Dim Mydatabase
Private Sub Form_Load()
Drive1.Drive = App.Path
'添加數據備份卡到列表中
ListView1.ListItems.Clear
If File1.ListCount <> 0 Then
a = 0
Do While File1.ListIndex < File1.ListCount - 1
File1.ListIndex = a
key = File1.FileName
If Right(key, 3) <> "mdb" Then
Set itmX = ListView1.ListItems.Add(, , key, 1)
End If
a = a + 1
Loop
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
Form_Load '調用Form_Load過程
Label1.Caption = Dir1.Path & "\" & File1.FileName
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
Label1.Caption = Dir1.Path & "\" & File1.FileName '獲取路徑
End Sub
Private Sub Command1_Click()
If Option1.Value = True Then
'備份數據庫
If File1.ListCount <> 0 Then
If Right(File1.FileName, 3) <> "mdb" Then
MsgBox "數據庫格式不正確,系統(tǒng)無法進行備份!"
Exit Sub
End If
Mydatabase = Date & "備份卡" & Left$(File1.FileName, Len(File1.FileName) - 3) & "BAK"
If Dir(Mydatabase) <> "" Then
MsgBox "今天的備份已完成!"
Else
FileCopy Trim(Label1.Caption), Mydatabase
MsgBox "數據備份成功!"
key = Date & "備份卡" & Left$(File1.FileName, Len(File1.FileName) - 3) & "BAK"
Set itmX = ListView1.ListItems.Add(, , key, 1)
End If
End If
End If
If Option2.Value = True Then
'恢復數據庫
If File1.ListCount <> 0 Then
FileCopy ListView1.SelectedItem, App.Path & "\books.mdb"
Me.MousePointer = 0
MsgBox "數據已恢復完畢!"
Else
MsgBox "請選擇要恢復的數據!"
End If
End If
End Sub
Private Sub Command2_Click()
frm_main.Enabled = True
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -