⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 33.txt

📁 VB文章集(含API、窗口、数据库、多媒体、系统、文件、等等)
💻 TXT
字号:
从各方面简化文件检查 
Simple file checking from anywhere
By Matthew Kent, mace@pacificcoast.net
To keep my applications running smoothly, I often need to check that certain files exist. So, I注释:ve written a simple routine to make sure they do. Here it is: 

Public Sub VerifyFile(FileName As String)
  注释:
  On Error Resume Next
  注释:Open a specified existing file
  Open FileName For Input As #1
  注释:Error handler generates error message with file and exits the routine
  If Err Then
    MsgBox ("The file " & FileName & " cannot be found.")
    Exit Sub
  End If
  Close #1
注释:
End Sub

Now add a button to your form and place the code below behind the "Click" event.

Private Sub cmdVerify_Click()
  注释:
  Call VerifyFile("MyFile.txt")
  注释:
End Sub 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -