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

📄 v6bj11-14.frm

📁 内有多个vb6.0数据库编写程序 可以让大家参考 希望对这个站有帮助....
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "VB6 例11-14 错误处理"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Activate()
Print "单击窗体,提示A驱动器未准备好。"

End Sub

Private Sub Form_Click()
    On Error GoTo ErrorHandler
    FileCopy "A:\ Student.mdb ", "C:\ Student.mdb "
    Exit Sub                                ' 正常退出本程序
ErrorHandler:                                   ' 错误处理块入口
    ' 以下语句利用Err对象的属性Number指示的错误号处理出错
    Select Case Err.Number
    Case 53                             ' 出错号53为文件不存在
    Style = vbRetryCancel + vbCritical + vbDefaultButton2
    Response = MsgBox("文件不存在!", Style, Err.Number & "出错")    ' 等待用户处理
    Case 71                             ' 71驱动器未准备好
    Style = vbRetryCancel + vbExclamation + vbDefaultButton2
    Response = MsgBox("A盘未准备好!", Style, "71出错")
    Case Else                               ' 当发生其他不可预知的错误,退出本程序
    MsgBox Err.Number & "出错,退出本程序!"
    End Select
    If Response = vbCancel Then Exit Sub                ' 若按下Cancel按钮,放弃处理
    Resume                              ' Resume再次执行原出错语句

End Sub

⌨️ 快捷键说明

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