خطا Unhandled Exception در حین اجرای برنامه در سی شارپ
سلام دوستان خسته نباشید ، دوستان من یه پروژه دارم و کلا مراحل نصبشم انجام دادم وقتی که برنامه م نصب میشه و برنامه مو اجرا می کنم با پیغام خطای زیر مواجه میشه ممنون میشم راهنمایی کنید
6 پاسخ
سلام برنامه مد منیجر توتال وار من این ارور تصویر بالا رو میده قبلا این ارور نمیداد لطفا راهنمایی کنید
باعرض سلام وخسته نباشید.من یک مشکلی در برنامه سی شارپ دارم و مدتی است که درگیر این خطا شده ام.
من در بخش evensرخداد form closingمیشوم. ودر آنجا برای ذخیره کردن برنامه در هنگام خارج شدن از برنامه کدی را می نویسم
System.IO.File.WriteAllText(@"c:\layout.txt", txtnotepad.BackColor.Name)
وبعد وقتی وارد برنامه میشوم وهنگامی که از برنامه میخواهم خارج شوم.خارج نمی شود و در قسمت ارور برنامه همچین خطایی را به من میدهد
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
میخواستم بدونم مشکلش از کجاست
سلام دوست عزیز، احتمالاً جایی دارید مقداری از نوع رشته رو به یک نوع دیگه تبدیل می کنید و این موضوع مشکل ساز هست. اگر Detail خطا رو به صورت کامل اینجا بزارید بهتر میشه کمکتون کرد.
جزییاتش به شکل زیر:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at WindowsFormsApplication8.Form3.Form3_Load(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at A.H.QJ(Message& A) at A.K.QJ(Message& A) at A.GO.AR(Message& A) at A.GO.QJ(Message& A) at A.H.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- TP-Link Modem Security Settings Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/TP-Link%20Modem%20Security%20Settings.exe ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- DevExpress.XtraEditors.v15.2 Assembly Version: 15.2.7.0 Win32 Version: 15.2.7.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/DevExpress.XtraEditors.v15.2.DLL ---------------------------------------- DevExpress.Utils.v15.2 Assembly Version: 15.2.7.0 Win32 Version: 15.2.7.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/DevExpress.Utils.v15.2.DLL ---------------------------------------- DevExpress.Data.v15.2 Assembly Version: 15.2.7.0 Win32 Version: 15.2.7.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/DevExpress.Data.v15.2.DLL ---------------------------------------- System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- SkinSoft.VisualStyler Assembly Version: 2.4.0.0 Win32 Version: 2.4.0.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/SkinSoft.VisualStyler.DLL ---------------------------------------- DevComponents.DotNetBar2 Assembly Version: 11.7.0.0 Win32 Version: 11.7.0.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/DevComponents.DotNetBar2.DLL ---------------------------------------- Accessibility Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll ---------------------------------------- System.Data Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- DevExpress.XtraLayout.v15.2 Assembly Version: 15.2.7.0 Win32 Version: 15.2.7.0 CodeBase: file:///C:/Program%20Files%20(x86)/Microsoft/Setup1/DevExpress.XtraLayout.v15.2.DLL ---------------------------------------- System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.
تو این قسمت:
at WindowsFormsApplication8.Form3.Form3_Load(Object sender, EventArgs e)
داری با Parse رشته رو به عدد تبدیل می کنی که رشته قابل تبدیل به عدد نیست، می تونی با try..catch حلش کنی، اما بگرد ببین دلیل ورودی اشتباه چی هست.
با try catch این موضوع حل شدنی ست؟