Sub showerror ()
Dim s As String
Dim crlf As String
crlf = Chr(13) Chr(10)
s = "运行时发生下列错误:" crlf
注释:add the error string
s = s Error$ crlf
注释:add the error number
s = s "错误码为: " CStr(Err)
Beep 注释:beep and show the error
X= MsgBox (s,2)
End Sub
调用例子:
sub abc()
onerror goto 1’发生错误时转到 1
.
.
程序体
.
.
exit sub
1
showerror
if err=… then
.
.
错误处理部分
.
.
endif
exit sub
end sub
上一篇: VB开发技巧三则
下一篇: VB使用编程技巧三则
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




