谁能告诉我如何在vb中实现错误处理?哪位大侠给个公用函数,小弟急用感谢大家

解决方案 »

  1.   

    on error goto
    on error resume
      

  2.   

    on error goto goto errorhand
    ****errorhand:
    msgbox "****"
      

  3.   

    1.不给出错误描述:
    On Error Resume Next2.给出描述:
    On Error Goto ErrHandle
    .
    .
    .
    ErrHandle:
        Msgbox Err.Description 3.On Error Goto 0
      

  4.   

    private sub ** ()on error goto errhandle
    .
    .
    .
    ..
    exit sub
    errhandle:
     select case err.number
            case *
            
            case * end select
    end sub
    通常一个过程的完整错误处理都是这个模式
      

  5.   

    1.忽略错误:
    On Error Resume Next2.错误跳转:
    On Error Goto Err
    ……
    ErrHandle:
        Msgbox Err.Description
      

  6.   

    1、忽略错误
    on error tesume next
    on error goto 0
    2、错误条转并报告错误
    on error goto ErrhandlerErrhandler:
        msgbox ""