?? form1.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2985
ClientLeft = 60
ClientTop = 345
ClientWidth = 4455
LinkTopic = "Form1"
ScaleHeight = 2985
ScaleWidth = 4455
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command4
Caption = "Save As"
Height = 375
Left = 240
TabIndex = 4
Top = 2400
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 720
TabIndex = 1
Top = 600
Width = 2535
End
Begin VB.CommandButton Command3
Caption = "Exit"
Height = 375
Left = 2400
TabIndex = 3
Top = 1680
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "Compact"
Height = 375
Left = 840
TabIndex = 2
Top = 1680
Width = 1215
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = ">>"
Height = 375
Left = 3240
TabIndex = 0
Top = 600
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txt As String
Private Sub Command1_Click()
Dim Fname As String
CommonDialog1.Filter = "Access 文件(*.MDB)|*.MDB|文本文件 (*.Txt)|*.Txt|所有文件 (*.*)|*.*" '設置檢索文件類型
CommonDialog1.FileName = "" '設置要的文件名
CommonDialog1.Action = 1 'Actin方法等于1為打開CommonDialog窗口,等于 CommonDialog1.ShowOpen
If Err <> 32755 Then
'Fname = CommonDialog1.FileName
Form1.Caption = CommonDialog1.FileName '將窗口標題改為文件名
End If
' CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
CompactFile = Text1.Text
End Sub
Private Sub Command2_Click()
Dim TmpStr1 As String
Dim TmpStr2 As String
Dim TmpStr3 As Integer
Dim TmpMDB As String
On Error Resume Next
'CommonDialog1.Filter = "Access 文件(*.MDB)|*.MDB|文本文件 (*.Txt)|*.Txt|所有文件 (*.*)|*.*"
If Text1.Text = "" Then
MsgBox "文件名稱為空,請選擇Access 數據庫文件?。。?quot;, vbOKOnly + vbInformation, "Test"
Text1.SetFocus
Exit Sub
End If
TmpStr1 = Text1.Text
TmpStr2 = ".mdb"
TmpStr3 = InStrRev(TmpStr1, TmpStr2, Len(TmpStr1))
TmpMDB = Mid$(TmpStr1, TmpStr3, 4)
If Text1.Text = "" Or TmpMDB <> TmpStr2 Then
MsgBox "文件名稱為空或文件不對,請選擇Access 數據庫文件?。。?quot;, vbOKOnly + vbInformation, "Test"
Text1.SetFocus
Else
CompactJetDatabase CompactFile, True
End If
If Err.Number <> 0 Then
MsgBox "沒有找到該文件,請打開正確的文件?。。?quot;, vbOKOnly + vbInformation, "Test"
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
Dim Location As String
If Text1.Text <> "" Then
txt = Text1.Text
CommonDialog1.Filter = "Access 文件(*.MDB)|*.MDB|文本文件 (*.Txt)|*.Txt|所有文件 (*.*)|*.*"
'initdiv = "E:\" '默認路徑
CommonDialog1.FileName = txt '默認文件名
CommonDialog1.ShowSave
'FileCopy CompactFile, Location
Else
MsgBox "文件不存在,請選擇文件?。?!", vbOKOnly + vbInformation, "Test"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -