Thats a bloody good idea smartarse.
> The is (normally) only one thread processing the message loop in winforms,
> commonly named the "ui thread". This will process each subscriber to teh
> Closing event in turn, then close the form.
> My guess would be the cleanup code is assigning the null to the dataset.
> You
> could potentially try wrapping the dataset in a property. Then putting a
> breakpoint in the set method and seeing if it is explicitly set to null.
> The
> stackframe window would enable you to look up the stack at where in your
> code
> it was done.
>
>
> --
> Ciaran O''Donnell
>
http://wannabedeveloper.spaces.live.com >
>
> "Steven Spencer (Spinalogic)" wrote:
>
>> Gday,
>>
>> I'm a java developer turned .net developer, and I'm unfamiliar with some
>> concepts, especially the event loop.
>>
>> We have a form in which upon closing needs to save a significant amount
>> of
>> data, and perform some thread cleanup etc for long running tasks. We
>> have
>> added a handler to the "closing" event on the form to do this.
>> Occasionally
>> on exiting the form (not shown modally) we end up with our dataset (which
>> is
>> perfectly accessed up to two or three times before) coming up with a null
>> reference exception. What I wanted to know is how the event handler
>> works?
>> Does it wait for all registered handlers of the event to execute and THEN
>> dispose the form? Or does it simply dispose at some point after calling
>> the
>> closing method.
>>
>> IF someone knew a good tute to understand the message loop on the
>> winforms,
>> that would be great too.
>>
>> PS forgive me if this is a primitive question.
>>
>>
>>