hello, im making an RPG and i have a pause menu setup to where it shows over the game screen. i have a quit button, and i want to know the code that will make that quit button close all forms. any help will be much appreciated thanks.
Public Sub CloseAllForms()
Dim Frm As Form
Unloadfrms:
Frmlist = ""
For Each Frm In Forms
Frmlist = Frmlist & Frm.Name & vbCrLf
Unload Frm
Set Frm = Nothing
Next
' uncomment line below for debugging
'Msgbox Frmlist
If Frmlist <> "" Then
Goto Unloadfrms
End If
End Sub
I've been programming with VB for 13 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning
Better way
Public Sub CloseAllForms()
Dim Frm As Form
Unloadfrms:
Frmlist = ""
For Each Frm In Forms
Frmlist = Frmlist & Frm.Name & vbCrLf
Unload Frm
Set Frm = Nothing
Next
' uncomment line below for debugging
'Msgbox Frmlist
If Frmlist <> "" Then
Goto Unloadfrms
End If
End Sub
Close All Forms
Well its easy enough to close all Forms your app is using with. Just add this Sub to a Module so it can be called from any Form.
Public Sub CloseAllForms()
Dim Frm As Form
For Each Frm In Forms
Unload Frm
Set Frm = Nothing
Next
End Sub
Keith
www.martin2k.co.uk/forums/
I've been programming with VB for 13 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning
Post new comment