Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

Program termination

$
0
0
In the app's main form's Unload event I have this code:
Code:

    For Each Frm In Forms
        Set Frm = Nothing
    Next

Now, there's a button in the main form that when clicked on shows a second form in modal style:

frm2.Show 1

If I close this form hiding it instead of unloading it, then when the above Unload code runs the program does not terminate (I'm working in the IDE) so I have replaced frm2.Hide by Unload Me (frm2) and now program ends corrcetly.

The question is, if there wrere reasons for using frm2.Hide instead of Unload frm2, could I place the unload statements in the main form's unload event like this?

Code:

    For Each Frm In Forms
        Unload Frm    'Is this OK?
        Set Frm = Nothing
    Next


Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>