Information générale
Catégorie:
Codage, syntaxe et commandes
>> I understand that. But what would prevent normal form release? The procedure is quite simple. It's basicaly a 'holdable button' that uses a timer to repeat a task as long a the button is held down. It doesn't matter what the task is, because I've commented out the code, so I know the problem must be in the holddown code somewhere. However, I've used the holdable class in other places and never had any problems. Quite strange.
>
>Mike,
>
>What can prevent the fomr from releasing is any external object reference to the fomr or anyone of its controls. For example if the timer has a property that references the Button (or vice versa) and you try to relase the fomr, the form in trun tries to release all of the controls. However when it tries to release the button it cannot because the timer has a reference to that button, so the button release fails and in turn the form release fails.
>
>If you are holding object references like this you are responsibile for cleaning them up. One way to do this is to recurse through all of the controls in the form iside the form's release and call a cleanup method (that you created for teh contrl) that will .NULL. any object reference properties before the normal action of the form's release tries to blow the controls away.
Jim,
Thanks for the help! You hit it right on the head. The container holding the button and the timer held a reference to the button. Once I cleared that, all went well. Thanks again, I'm sure this will save me many headaches in the future!
Regards,
Mike
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement