|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Could not close winFormIn my winForm, when user select QUIT, and I will use multi threading to save user information and then close the application. Sometime it will throw 'Object reference not set to an instance of an object.' I'm the following error fairly often (but randomly), and I can't figure out why it is happening. Any ideas? Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.DefWndProc(Message& m) at System.Windows.Forms.Control.WmUpdateUIState(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.ParkingWindow.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) when you close your form, threads its process created terminate. if you
really need to do something lengthy after the form is closed, do it in a separate process. Show quote "Ayrton Phoenix da silva" wrote: > Dear all, > > In my winForm, when user select QUIT, and I will use multi threading to save > user information and then close the application. Sometime it will throw > 'Object reference not set to an instance of an object.' I'm the following > error fairly often (but randomly), and I can't > figure out why it is happening. Any ideas? > > Object reference not set to an instance of an object. > System.NullReferenceException: Object reference not set to an instance of an > object. > at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr > wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) > at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) > at System.Windows.Forms.Control.DefWndProc(Message& m) > at System.Windows.Forms.Control.WmUpdateUIState(Message& m) > at System.Windows.Forms.Control.WndProc(Message& m) > at System.Windows.Forms.ScrollableControl.WndProc(Message& m) > at System.Windows.Forms.ContainerControl.WndProc(Message& m) > at System.Windows.Forms.ParkingWindow.WndProc(Message& m) > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, > IntPtr wparam, IntPtr lparam) > > > "Ayrton Phoenix da silva" <phoe***@flex-logic.com> schrieb: Are you sure you are not accessing Windows Forms controls'/forms' instance > In my winForm, when user select QUIT, and I will use multi threading to > save user information and then close the application. Sometime it will > throw 'Object reference not set to an instance of an object.' I'm the > following error fairly often (but randomly), and I can't > figure out why it is happening. Any ideas? members directly from within your threads? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> I thought the companies would be more selective in hiring these days...
Show quote "Herfried K. Wagner [MVP]" wrote: > "Ayrton Phoenix da silva" <phoe***@flex-logic.com> schrieb: > > In my winForm, when user select QUIT, and I will use multi threading to > > save user information and then close the application. Sometime it will > > throw 'Object reference not set to an instance of an object.' I'm the > > following error fairly often (but randomly), and I can't > > figure out why it is happening. Any ideas? > > Are you sure you are not accessing Windows Forms controls'/forms' instance > members directly from within your threads? > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> > > "Serg" <S***@discussions.microsoft.com> schrieb: ?!?>I thought the companies would be more selective in hiring these days... -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> That was pertaining to the orignal post, and my reply was of course a joke.
Nothing ?!? about it. Show quote "Herfried K. Wagner [MVP]" wrote: > "Serg" <S***@discussions.microsoft.com> schrieb: > >I thought the companies would be more selective in hiring these days... > > ?!? > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> > Many thank for help!!!
I got idea.. let me trace the bug now.. :-p Show quote "Ayrton Phoenix da silva" <phoe***@flex-logic.com> wrote in message news:e5XJz3Q0EHA.2676@TK2MSFTNGP12.phx.gbl... > Dear all, > > In my winForm, when user select QUIT, and I will use multi threading to > save user information and then close the application. Sometime it will > throw 'Object reference not set to an instance of an object.' I'm the > following error fairly often (but randomly), and I can't > figure out why it is happening. Any ideas? > > Object reference not set to an instance of an object. > System.NullReferenceException: Object reference not set to an instance of > an object. > at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr > wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) > at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) > at System.Windows.Forms.Control.DefWndProc(Message& m) > at System.Windows.Forms.Control.WmUpdateUIState(Message& m) > at System.Windows.Forms.Control.WndProc(Message& m) > at System.Windows.Forms.ScrollableControl.WndProc(Message& m) > at System.Windows.Forms.ContainerControl.WndProc(Message& m) > at System.Windows.Forms.ParkingWindow.WndProc(Message& m) > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, > IntPtr wparam, IntPtr lparam) > > |
|||||||||||||||||||||||