[RESOLVED] Subclassing usercontrols (Previously: App closing sequence)
Hello!
I'm stuck on a problem i cant overcome. The problem is that my app is wont close up itself in the right order. Ive put a tons of debug out lines, to see what is the initialization, then termination and unload sequence of each usercontrol, class, forms and the main mdiform. (theres a lot of objects, i used a timestamped file output for my custom debugging)
At in every log, i see differences, sometimes the main mdi form will unload then terminates itself, in the middle of the closing sequence, but sometimes (just like i want it to) it closes itself at the end, but before terminating its content form. Sometimes, i also see 'rumbles' in the termination of class objects and usercontrols. They just change their order, found no reason why. (there are some usercontrols they contain timers, but not those im talking about)
The most painful thing is, that on rare case, it crashes the app also. unfortunately these crashes are just happen pretty much rare cases, so i cant track down what the reason of it. But im sure, that all timers are set to offline.
I use DoEvents in Terminate() and Unload() events, to fire the timers once again, before the form or object will close. Is that could happen, that the reason will be the timers or the DoEvents? What else can i do to stop everything before i execute the shutdown? Especially in case, when the mdi form will not unload/terminate itself, but after the half of its content?!
The project is huge enough, that i cant upload here.
-------------------------------------
In the meantime i typing this i included some routine into my mdi form's queryunload, that will walk thru on each mdi child and execute a speicifed subroutine that will do some inner workings, to unset the timers in their contained usercontrols, classes and so on... I hope it will works, ill report here my experiments.
Any input is welcome.