Home All Groups Group Topic Archive Search About
Author
23 Nov 2004 3:38 AM
Ayrton Phoenix da silva
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)

Author
23 Nov 2004 4:19 AM
Serg
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)
>
>
>
Author
23 Nov 2004 8:01 AM
Herfried K. Wagner [MVP]
"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/>
Author
23 Nov 2004 10:19 PM
Serg
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/>
>
>
Author
23 Nov 2004 11:09 PM
Herfried K. Wagner [MVP]
"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/>
Author
24 Nov 2004 12:07 AM
Serg
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/>
>
Author
25 Nov 2004 3:47 AM
Ayrton Phoenix da silva
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)
>
>

AddThis Social Bookmark Button