ERROR ON CLOSING MY PROGRAM WHEN THREADING IS USING

Hi guys.. i need your solutions about my problem. Here, when i make a threading code then i close the main form, it displayed :

"An unhandled exception of type system.nullreferenceexception occured in system.windows.forms.dll

additional information object referenced not set to an instance of an object."

i cant find any solution about it by my self... :(

Anyway thanks for your great solutions...




Answer this question

ERROR ON CLOSING MY PROGRAM WHEN THREADING IS USING

  • Martin Henke

    Your next step should be to look at the stack trace to see where this error occured, so you can look at the code and work out why.



  • Help me please

    OK, I can't be sure where the problem was without seeing the code. But, it sounds like it's fixed, so that's good.



  • Otto Fischer

    No, you need to catch the exception, by handing the applicationexception event and, from the sound of it, the threaded event as well. Then you can get a stack track from the exception that's being thrown.

  • Roquefort

    I did catch the error. But it cant be catched by my error handler. The exception occured after my application is terminated. But if i change the threading with timer, it's not occured anymore :) was it my fault in coding or was it Visual Studio .net's IDE bugs I hav no idea about it. :)

  • paulinmadison

    Thanks, but the error is appeared without any stack trace or error number. That's why i feel a little bit dizzy...

    the condition like this :

    1. I made a form, let's say it's name is FormThread, in this form (event load) i wrote a code like this :

    Thread lclThread = new Thread (new ThreadStart(myprocedure));

    lclThread.Start();

    2. in myprocedure method, i wrote a code that communicate to any device lets say that device is a digital camera. This procedure task is doing any survilence action.

    3.Whether it's opened or closed, then i close the Application form, that's exception handling is displayed without any information about stack trace or error number.



  • Krish Srinivasan

    thanks four your thought cgraus... :)

  • ERROR ON CLOSING MY PROGRAM WHEN THREADING IS USING