[译]Visual Basic项目中的错误处理
By robot-v1.0
本文链接 https://www.kyfws.com/applications/error-handling-in-visual-basic-projects-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 4 分钟阅读 - 1815 个词 阅读量 0[译]Visual Basic项目中的错误处理
原文地址:https://www.codeproject.com/Articles/11528/Error-Handling-In-Visual-Basic-Projects
原文作者:hooshang Karami
译文由本站 robot-v1.0 翻译
前言
Insert Error Hanler In Your Visual Basic Projects Easily
下载错误处理程序(Download Error Handler) (右键单击并选择目标另存为…)((Right Click And Select Save Target As… ))
下载网址:(URL For Download:) http://helia2000.tripod.com/index_files/ErrorHandler.htm(http://helia2000.tripod.com/index_files/ErrorHandler.htm)
你好(Hello)
当程序员开发系统时,重要步骤是支持系统和(When A System Developed By Programmer The Important Step IS Supporting System and)
调试系统最受欢迎的步骤是由使用此系统的用户报告错误,但Somtimes用户不报告错误.(Debugging System The most Popular Step Is Reporting Bugs By Users That Using This Systems But Somtimes Users Dont Reports Error.)
该错误处理程序的最终目标是帮助VB系统开发人员报告此错误.该系统非常适合该想法.它通过此错误处理在Vb表单中插入错误HAndler标记,您可以看到哪个用户有错误,什么是错误描述以及哪个模块或表单或UserControl或报表有错误,并且在此窗体或用户控件或报告哪个函数或子程序有错误.(My End Goal Of This Error Handler Program Is Help to VB system Developers To Reporting This Bugs. This System Is Very UseFull Tools For This Idea.It Is Inserts Error HAndler Tag In Vb Forms By This Error Handling You Can see Which User Have Error and What Is The error Descrpition And Which Module Or form Or UserControl Or Reports Has erros And In This Form Or UserControl Or Reports Which Function Or Sub Has errors .)
轻松插入后,您可以删除此错误处理程序选项.(You Can Remove This Error Handler TAg After Inserting Easily.)
我在会计等四大系统中使用该系统…(I Use This Syetem In Four Big Syestem Like Accounting… And I Acquiesce from This Tool)
请向我发送有关此程序的反馈以进行改进.(Please Send Me your FeedBack About This Program To Improve It.)
谢谢(Thank you)
更改之前的示例代码(Sample Code Before Change)
私人子Form_Load()(Private Sub Form_Load()) “我的代码从这里开始(‘My Code Starts here)
‘我的代码到此结束(‘My code end Here)
结束子(End Sub)
插入错误处理程序后的示例代码(Sample Code After Inserting Error Handler)
私人子Form_Load()(Private Sub Form_Load()) 发生错误时转到Torr_Label:'* ErrorHandler标签*'(*On Error GoTo Err_Label: ‘*ErrorHandler Tag*'*) Dim StrSubName As String’* ErrorHandler Tag *'(*Dim StrSubName As String ‘*ErrorHandler Tag*'*) 将Dim ErrorDescription设置为字符串’* ErrorHandler Tag *'(*Dim ErrorDescription As String ‘*ErrorHandler Tag*'*) StrSubName =” Form_Load"'* ErrorHandler标签*'(*StrSubName = “Form_Load” ‘*ErrorHandler Tag*'*) Me.MousePointer =11’* ErrorHandler标签*'(*Me.MousePointer = 11 ‘*ErrorHandler Tag*'*)
“我的代码从这里开始(‘My Code Starts here)
‘我的代码到此结束(‘My code end Here)
Me.MousePointer =1’* ErrorHandler标签*'(*Me.MousePointer = 1 ‘*ErrorHandler Tag*'*) 退出Sub’* ErrorHandler Tag *'(*Exit Sub ‘*ErrorHandler Tag*'*) Err_Label:” * ErrorHandler标记*"(*Err_Label: ‘*ErrorHandler Tag*'*)
ErrorDescription =Me.Name +"->" + StrSubName +"->" +错误描述’* ErrorHandler Tag *'(*ErrorDescription = Me.Name + “–>” + StrSubName + “–>” + Err.Description ‘*ErrorHandler Tag*'*) MsgBox ErrorDescription + vbCrLf +“请与系统管理员联系”,vbCritical,“错误处理程序”'* ErrorHandler标签*'(*MsgBox ErrorDescription + vbCrLf + “Please Contact With Your System Administrator”, vbCritical, “ERROR HANDLER” ‘*ErrorHandler Tag*'*) MousePointer =1’* ErrorHandler标签*'(*MousePointer = 1 ‘*ErrorHandler Tag*'*) ErrorDescription =Replace(ErrorDescription,"'","")'* ErrorHandler标签*'(*ErrorDescription = Replace(ErrorDescription, “'”, " “) ‘*ErrorHandler Tag*'*) MainConnection.执行"将INERT插入Errors_Log(ComputerName,Error_Date,Error_Time,UserName,Error_Description)VALUES('” + sGetComputerName +"’,'"&Date&"’,'"&Time&"’,'"&CurUser&" ‘,'"&ErrorDescription&"')"'* ErrorHandler标记*'(*MainConnection.Execute “INSERT INTO Errors_Log (ComputerName,Error_Date,Error_Time,UserName,Error_Description) VALUES ('” + sGetComputerName + “’,'” & Date & “’,'” & Time & “’,'” & CurUser & “’,'” & ErrorDescription & “')” ‘*ErrorHandler Tag*'*) 结束子(*End Sub*)
后上卡拉米(Houshang Karami)
伊朗德黑兰(Iran-Tehran)
我的电子邮件地址是:(My Email Is:)Houshang.karami@gmail.com(Houshang.karami@gmail.com)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ Windows WinXP Visual-Studio Dev 新闻 翻译