Did you read the post that I wrote you? Are you looking for the WinAPI call or is this some method you are trying to write on your own that closes all of the windows of your application?
Sir, thank you for your info.
I am trying to write a method by my own that closes all the windows of my application.
I am looking for a piece of code to implement then test it.
You will want to use the Model-View-Controller design pattern. This way, your controller can fire a Close event and your views can react to it accordingly.
If you have forms scattered and in no way associated to eachother, you will have issues and any solution you put in to close these windows will be a hack.
One way would be to loop through the Form objects exposed by the Application.OpenForms collection. But since there are likely to be inter-form dependencies, you might need to either brute-force it by looping through the list until there are no more, or by building a tree structure by following all the parent-child relationships, and then doing a post-fix traversal.
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.