📄 frm_bf.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Frm_bf
Caption = "数据备份"
ClientHeight = 4875
ClientLeft = 60
ClientTop = 345
ClientWidth = 6375
Icon = "Frm_bf.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4875
ScaleWidth = 6375
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
Caption = "返 回"
Height = 345
Left = 4545
TabIndex = 6
Top = 4455
Width = 1000
End
Begin VB.CommandButton Command1
Caption = "开始备份"
Height = 345
Left = 3240
TabIndex = 5
Top = 4455
Width = 1000
End
Begin VB.OptionButton Option1
Caption = "数据备份"
Height = 300
Left = 15
TabIndex = 3
Top = 5535
Width = 1110
End
Begin VB.Frame Frame1
Caption = "备份卡列表"
Height = 3375
Left = 60
TabIndex = 1
Top = 90
Width = 3060
Begin MSComctlLib.ListView ListView1
Height = 3045
Left = 120
TabIndex = 2
Top = 240
Width = 2835
_ExtentX = 5001
_ExtentY = 5371
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
Begin MSComctlLib.ImageList ImageList1
Left = 315
Top = 8325
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Frm_bf.frx":1C7A
Key = ""
EndProperty
EndProperty
End
End
Begin VB.Frame Frame2
Caption = "请选择数据库文件"
Height = 3375
Left = 3195
TabIndex = 0
Top = 90
Width = 3060
Begin VB.DriveListBox Drive1
Height = 300
Left = 120
TabIndex = 9
Top = 240
Width = 2655
End
Begin VB.DirListBox Dir1
Height = 720
Left = 120
TabIndex = 8
Top = 600
Width = 2655
End
Begin VB.FileListBox File1
Height = 1890
Left = 120
Pattern = "*.mdb"
TabIndex = 7
Top = 1320
Width = 2655
End
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 15
TabIndex = 4
Top = 4005
Width = 6210
_ExtentX = 10954
_ExtentY = 450
_Version = 393216
Appearance = 1
End
Begin VB.Label Label1
ForeColor = &H00000000&
Height = 375
Left = 60
TabIndex = 10
Top = 3540
Width = 6015
End
End
Attribute VB_Name = "Frm_bf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim workarea(600) As String
Dim itmX, key As String '定义字符串变量
Dim counter As Integer '定义一个整型变量
Dim a As Integer '定义整型变量
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Sub Form_Load()
' Option1.Value = True
Dir1_Change
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
'添加数据备份卡到列表中
ListView1.ListItems.Clear '清空ListView控件中ListItem对象
If File1.ListCount <> 0 Then '如果列表项目的个数不为零执行备份操作
a = 0
Do While File1.ListIndex < File1.ListCount - 1 '当项目索引值小于项目个数时执行循环体
File1.ListIndex = a '设置项目索引为变量a的值
key = File1.FileName '将把选文件名赋给key
Set itmX = ListView1.ListItems.Add(, , key, 1) '向ListView控件中添加ListItem对象
a = a + 1
Loop
End If
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()
ProgressBar1.Visible = True
ProgressBar1.Max = UBound(workarea)
ProgressBar1.Value = ProgressBar1.Min
For counter = LBound(workarea) To UBound(workarea)
workarea(counter) = "initial value " & counter
ProgressBar1.Value = counter
' If Option1.Value = True Then
'备份数据库
If File1.ListCount <> 0 Then
CopyFile Trim(Label1.Caption), Date & "备份卡" & File1.FileName, False
Me.MousePointer = 0
End If
' End If
Next counter
ProgressBar1.Visible = False
ProgressBar1.Value = ProgressBar1.Min
' If Option1.Value = True Then
MsgBox "数据备份成功!", , "系统提示"
key = Date & "备份卡" & File1.FileName
Set itmX = ListView1.ListItems.Add(, , key, 1)
' End If
End Sub
Private Sub Command2_Click()
Unload Me
Frm_main.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -