2010-11-23 28 views
0

私はVisual Studio 2010を使用してVB.netで作成した最初のXAMLアプリケーションに問題があります。実行するたびに、適用ボタンをクリックします(私はいくつかのフィールドにデータを入力します適用ボタンをクリックすると、入力したメッセージのmessagebox.showが表示されます)、プログラムがクラッシュします。私はWindows 7 x64の究極のエディションを実行しています。何か案は?プログラムが予期せず終了する

イベントログは以下を示しています。

断層アプリケーション名:CreditCard.exe、バージョン:1.0.0.0、タイムスタンプ:0x4ceafa3a フォールティングモジュール名:KERNELBASE.dll、バージョン:6.1.7600.16385、タイムスタンプ: 例外コード0x4a5bdbdf:0xe0434352 障害オフセット:0x0000b727 断層のプロセスID:C:Chohan \ドキュメントは、プロジェクト\ Visual Studioの2010 \ \ \ Users \ユーザー第6章\のCreditCardの\のCreditCardアプリケーションパスをフォールティング0x01cb8b5a4900b2cb :0x14d0 エラー発生アプリケーションは、開始時刻\ bin \ Debug \ CreditCard.exe モジュールパスの障害:C:\ Windows \ syswow64 \ KERNELBASE.dll レポートイド:8eba45a2-f74d-11df-8e1c-506313a0ad71また


アプリケーション:CreditCard.exe Frameworkのバージョン:v4.0.30319 説明:プロセスは、未処理の例外が原因で終了しました。 例外情報:System.InvalidCastExceptionの スタック:Microsoft.VisualBasic.CompilerServices.Conversions.ToDoubleで Microsoft.VisualBasic.CompilerServices.Conversions.ToDoubleで(可能System.String、System.Globalization.NumberFormatInfo) (可能System.String) でSystem.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object、System.Windows.RoutedEventArgs)の でCreditCard.MainWindow.btnApply_Click(System.Object、System.Windows.RoutedEventArgs) System.Windows.EventRoute.InvokeHandlersImpl(System.Object、 (System.Windows.RoutedEventArgs、Boolean) (System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject、System.Windows.RoutedEventArgs)) (System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEvent))引数)System.Windows.Controls.Primitives.ButtonBase.OnClick(AT )System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUpでSystem.Windows.Controls.Button.OnClick() (System.Windows.Inputで 。 MouseButtonEventArgs)System.WindowsでSystem.Windows.Input.MouseButtonEventArgs.InvokeEventHandlerでSystem.Windows.UIElement.OnMouseLeftButtonUpThunk(System.Objectの、System.Windows.Input.MouseButtonEventArgs) (System.Delegate、System.Objectの) で。 System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object、System.Windows.RoutedEventArgs)の にあるRoutedEventArgs.InvokeHandler(System.Delegate、System.Object) System.Windows.EventRoute.InvokeHandlersImpl(System.Object、 RoutedEventArgs、Boolean)System.Windows.UIElement.OnMouseUpThunk(System.Object、System.Windows.Input.MouseButtonEventArgs)のにあるSystem.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject、System.Windows.RoutedEventArgs、System.Windows.RoutedEvent) System.Windows.Input.MouseButtonEventArgs.InvokeEventHandlerで System.Windows.RoutedEventHandlerInfo.InvokeHandlerでSystem.Windows.RoutedEventArgs.InvokeHandlerで(System.Delegate、System.Objectの) (System.Delegate、System.Objectの) (システム。 System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject、System.Windows)。 にSystem.Windows.EventRoute.InvokeHandlersImpl(System.Object、System.Windows.RoutedEventArgs、Boolean) にあります。System.Windows.Input.InputManager.ProcessStagingAreaでSystem.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs、ブールでSystem.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs) ) () でRoutedEventArgs) System.Windows.Input.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs) at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput (IntPtr、System.Windows.Input.InputMode、Int32、System.Windows.Input.RawMouseActions、Int32、Int32、Int32) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr、MS.Internal.Interop.WindowMessage、IntPtr 、IntPtr、Boolean ByRef) at System.Windows.Interop.HwndSo urce.InputFilterMessage(のIntPtr、のInt32、のIntPtr、のIntPtr、ブールのByRef)MS.Win32.HwndWrapper.WndProc(のIntPtr、のInt32、のIntPtr、のIntPtr、ブールのByRef)MS.Win32.HwndSubclass.DispatcherCallbackOperationで で(System.Objectの) System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate、System.Object、Int32)の で MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object、System.Delegate、System.Object、Int32、System。代理人) at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority、System.TimeSpan、System.Delegate、System.Object、Int32) (MS.Win32.HwndSubclass.SubclassWndProc(IntPtr、Int32、 IntPtr、IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) at System.Windows.Threading.Dispatcher。 Run() at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at System.Windows.Application.Run(System.Windows.Window) CreditCard.Application.MainでSystem.Windows.Application.Run() ()

答えて

0

例外スタックを実際に読んでいれば、自分でエラーが発生します。

System.InvalidCastExceptionのスタック:それはあなたの[適用]ボタンのイベントハンドラでありますMicrosoft.VisualBasic.CompilerServices.Conversions.ToDoubleでMicrosoft.VisualBasic.CompilerServices.Conversions.ToDouble(可能System.String、System.Globalization.NumberFormatInfo)(システムでCreditCard.MainWindow.btnApply_Click(System.Objectの、System.Windows.RoutedEventArgs)で).String文字列からダブルへの変換が正しく

+0

yep - 私のコーディングの一部で誤ったタイプミス!それを何百回も経験した後、それを一歩一歩見て、ついに実現しました!しかし、助けてくれてありがとう - 私はあなたが探しているはずの場所を狭めるのを助けた。 – lara400

0

であなたはDoubleStringをキャストしようとしている、それが例外をスローです。

ToDouble(System.String, System.Globalization.NumberFormatInfo)

+0

うんを取り扱いしておりません

で - それを考え出した - いまいましいタイプミス私のコーディングの一部!それを何百回も経験した後、それを一歩一歩見て、ついに実現しました!しかし、助けてくれてありがとう - 私はあなたが探しているはずの場所を狭めるのを助けた。 – lara400

0

System.InvalidCastExceptionの

あなたはテキストボックス内の文字列を入力環境と整数としてそれを解析したり、二重されている場合は、このようなエラーが発生します。

+0

'TextBox'の' string'がすべて数値でない場合。 – Gabe

+0

+1(答えは素晴らしいからではありませんが、-1が少し厳しいように見えるからではありません) - 私はpersonalityがAliのことを十分に明確にし、確かに価値がないと考えています。 – Sheridan