错误号问题

chenjie1981 2003-09-11 08:14:21
在vb.net里面调试程序时往往会得到一些错误号,这些错误号的意思在什么地方查询?
...全文
216 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenjie1981 2003-09-12
  • 打赏
  • 举报
回复
这也是我第一次来csdn提出的问题。我知道.net带了一个错误号查询器,但查询时有很多错误查不到,而且有很多错误查询拒绝访问,但听ArLi2003你这样一说,我决定把注意力放在这上面了,谢谢你的指教
xixigongzhu好热心,真是谢谢了,你把这么错误号的意思告诉了我,还告诉我编程时一般查固定错误的方法,虽然不是我想要得答案,但也从中得到了很多东西,谢谢了。
xixigongzhu 2003-09-12
  • 打赏
  • 举报
回复
可以参考这个方法:
Public Function MapExceptionToNumber(e As Exception) As Integer
dim type As Type = e.GetType()
If (type Is GetType(System.IndexOutOfRangeException))
Return 9
End If
If (type Is GetType(System.RankException))
Return 9
End If
If (type Is GetType(System.DivideByZeroException))
Return 11
End If
If (type Is GetType(System.OverflowException))
Return 6
End If
If (type Is GetType(System.NotFiniteNumberException))
If (CType(e, NotFiniteNumberException).OffendingNumber = 0.0d)
Return 11
Else
Return 6
End If
End If
If (type Is GetType(System.NullReferenceException))
Return 91
End If
If (type Is GetType(System.InvalidCastException))
Return 13
End If
If (type Is GetType(System.NotSupportedException))
Return 13
End If
If (type Is GetType(System.Runtime.InteropServices.SEHException))
Return 99
End If
If (type Is GetType(System.DllNotFoundException))
Return 53
End If
If (type Is GetType(System.EntryPointNotFoundException))
Return 453
End If
If (type Is GetType(System.TypeLoadException))
Return 429
End If
If (type Is GetType(System.OutOfMemoryException))
Return 7
End If
If (type Is GetType(System.FormatException) )
Return 13
End If
If (type Is GetType(System.IO.DirectoryNotFoundException))
Return 76
End If
If (type Is GetType(System.IO.IOException))
Return 57
End If
If (type Is GetType(System.IO.FileNotFoundException))
Return 53
End If
If (TypeOf e is System.MissingMemberException)
Return 438
End If
If(TypeOf e is System.Runtime.InteropServices.InvalidOleVariantTypeException)
Return 5
End If
Return 458
End Function
ArLi2003 2003-09-12
  • 打赏
  • 举报
回复
系统错误可以用VC6/VC7 的错误号查找器

类库错误通常是有关联消息,比如

System.Data.OleDb.OleDbException e
将有

e.ErrorCode 及对应的 e.Message

你这个问题是我第一次来CSDN 学.net 时提的疑问

16,555

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧