读书人

请问怎么让程序不弹出异常提示

发布时间: 2013-03-06 16:20:31 作者: rapoo

请教如何让程序不弹出错误提示
请问vb.net如何让程序不弹出错误提示

程序运行中出现下列错误提示, 问你继续还是退出.
非常的烦人,因为主程序运行中会打开多个窗体,出错也只是其中一个出错,但是出这样的错误提示却影响到其他窗口工作.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidCastException: Conversion from string "" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
at foks.F4.Timer2_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


程序经常弹出错误提示,但不是致命的依然可以运行,

实在没有时间去一个个找错误在那里!!!!


请问各位大神,如何能让程序不弹出任何的错误提示呢?
比如调试什么的,非要你点一下确定才继续运行,真烦人啊


上次有论坛朋友提示: 关闭异常提示,但问题依旧会弹出
菜单里面:调试---异常..

展开,把你不要的异常取消掉就可以了.


继续请教高手如何能忽略讨厌的错误提示呢?
[解决办法]
加上try catch
[解决办法]

引用:
引用:加上try catch

已经加了,但是错误提示依旧


那是你加的位置不对

Conversion from string "" to type 'Integer' is not valid.

“” 不能转为 int
[解决办法]
引用:
引用:加上try catch

已经加了,但是错误提示依旧


你的在窗口的函数中加 try catch,Catch住所有异常有不要在throw了。
[解决办法]
Try
'程序代码
Catch ex As Exception
' MsgBox(ex.ToString) '显示错误信息
Finally
'程序处理代码,如:关闭连接等
End Try



在那个catch里面,把 MsgBox(ex.ToString) 这句话搞掉,也就是如果出错,就什么都不做,

但是你的问题没有描述清楚,不知道你是EXE单独运行的时候出错,还是在写代码调试的时候,出错

调试的时候,不管你catch里面是空的也好,还是非空的,有些错误(非简单的错误),还是会显示出来的,

但是只要不是致命的,EXE单独运行的时候,是没关系的。。

读书人网 >VB Dotnet

热点推荐