| | |
How to unload all open forms
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2006
Posts: 6
Reputation:
Solved Threads: 0
i may try that out but this is the warning issued in msdn under application.exit() method
CAUTION The Form.Closed and Form.Closing events are not raised when the Application.Exit method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the Form.Close method for each open form individually before calling the Exit method.
CAUTION The Form.Closed and Form.Closing events are not raised when the Application.Exit method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the Form.Close method for each open form individually before calling the Exit method.
•
•
Join Date: Feb 2006
Posts: 6
Reputation:
Solved Threads: 0
I used a for in vb to close all open forms but i am new to .Net and have not been able to do the same in .Net
Code in VB:
In .Net this does not work i guess...
Code in VB:
VB.NET Syntax (Toggle Plain Text)
for each frm in forms
VB.NET Syntax (Toggle Plain Text)
frm.close()
VB.NET Syntax (Toggle Plain Text)
next
In .Net this does not work i guess...
•
•
•
•
CAUTION The Form.Closed and Form.Closing events are not raised when the Application.Exit method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the Form.Close method for each open form individually before calling the Exit method.
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
This is for VB Express 2005:
VB.NET Syntax (Toggle Plain Text)
For i As Integer = My.Application.OpenForms.Count - 1 To 0 Step -1 If My.Application.OpenForms.Item(i) IsNot Me Then My.Application.OpenForms.Item(i).Close() End If Next i
•
•
Join Date: Feb 2008
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
If you're using .NET 2.0 then that's not the case anymore. Application.Exit() raises the Form.Closing events.
Application.Exit() causes all the dialogs to get closed. but, It creates some problems in my test applicatin. is there anyother way to close all the opened forms by the current Application..??
end
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
Well I've try also the code below:
but there were some forms that were not close or rather I say was not detected as openforms.
My question is when during opening the form and it encounters some errors but still able to load the form, does the form considered as not an openform?
VB.NET Syntax (Toggle Plain Text)
Dim openForm As Form = Nothing For index As Integer = My.Application.OpenForms.Count - 1 To 0 Step -1 openForm = My.Application.OpenForms.Item(index) If openForm IsNot Me AndAlso Not TypeOf openForm Is DevExpress.Utils.Win.TopFormBase Then openForm.Close() openForm.Dispose() openForm = Nothing End If Next
but there were some forms that were not close or rather I say was not detected as openforms.
My question is when during opening the form and it encounters some errors but still able to load the form, does the form considered as not an openform?
Last edited by jireh; Sep 23rd, 2009 at 3:03 am.
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
![]() |
Similar Threads
- using two forms or tabs (Visual Basic 4 / 5 / 6)
- where is wrong? (Visual Basic 4 / 5 / 6)
- HELP! What does this mean.......? (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: how to save a dynamic array in text file
- Next Thread: User Controls as Forms within a Form
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic beginner browser button buttons center checkbox client code convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms ftp generatetags gridview html images inline input insert intel internet lib listview mobile monitor net objects open panel passingparameters pdf picturebox port position print printing problem read remove save searchvb.net select serial settings shutdown soap sorting sqlserver survey table temperature textbox timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms wpf wrapingcode year






