What's Here?
- Members: 149,620
- Replies: 506,751
- Topics: 79,851
- Snippets: 2,666
- Tutorials: 706
- Total Online: 1,895
- Members: 68
- Guests: 1,827
|
This is the proper way to close all the forms in your application. Some say to just call End but that just crashes the program without raising an error
|
Submitted By: PsychoCoder
|
|
Rating:

|
|
Views: 1,675 |
Language: Visual Basic
|
|
Last Modified: August 14, 2008 |
Snippet
Private Sub CloseAllForms()
Dim frm as Form
'First we want to loop through all the
'Forms and close them (We close the current Form last)
For Each frm In Forms
'Make sure we arent looking at the current Form
If frm.hWnd <> Me.hWnd Then
'Unload this Form
Unload frm
Set frm = Nothing
End If
'Now get the next Form
Next frm
'Now unload the current Form
Unload Me
End Sub
Copy & Paste
|
|
|
Be Social
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|