jaimekb
09-11-2000, 09:08 AM
I need to enable and disable some functions in my application depending on if a particular form is open or closed. How can I detect that the user has closed the form without making it modal?
Detecting when a form is closedjaimekb 09-11-2000, 09:08 AM I need to enable and disable some functions in my application depending on if a particular form is open or closed. How can I detect that the user has closed the form without making it modal? PWNettle 09-11-2000, 12:05 PM One approach might be to examine your project's Forms collection, which contains a reference to all the loaded forms in your project. Check for the name of the form - if you find it the form is loaded. Keep in mind that a form can be loaded and not shown. <PRE>For intIndex = 0 To Forms.Count - 1 If Forms(intIndex).Name = strNameOfTargetForm Then ' strNameOfTargetForm is loaded. ' Do whatever. Else ' strNameOfTargetForm is not loaded. ' Do whatever. End If Next intIndex</PRE> Paul BillSoo 09-11-2000, 12:23 PM You could put the detection routine in a timer event on the main (or MDI) form. Or you could just put the code in the unload events in the specified forms. "I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum