Beginner again - Closing VB .net application

  • Thread starter Thread starter Steve Howard
  • Start date Start date
S

Steve Howard

From what I see in the help the following should close my app:-

Application.Exit()



but what it appears to do instead is freeze it. Suggestions?



Steve
 
While Application.Exit() should close your application, the definite
recommended way to exit would be to call the Close method on your main form
instead.
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ/ClosingForms


Ahhh, thanks. With a little more digging around, I found I could use
Me.Close() to achieve what I want.

Am I right in thinking that once I have built a more complex application I
will need to build something more robust - e.g. close each individual form
component first before issuing a Close.Me() to kill the entire application?


Steve
 
While I don't think that's absolutely necessary, I would say out of good
practice make sure to Close each open form before you Close your main form.
 
Tim Wilson said:
While I don't think that's absolutely necessary, I would say out of good
practice make sure to Close each open form before you Close your main
form.


Whilst looking for something else I found sample code that appeared to

- Keep a count of each form object used
- have something that then would close each in turn on demand, decrementing
a counter too.


Of course I cannot find that code now that I *want* it :-)

Is the above method strictly necessary, or is it possible to build something
like (pseudocode alert!!!!!)


repeat with Obj = each object in mainForm
Obj.Close
end


Steve
 
In the help file for Form.Show() it indicates that "when a form is closed,
all resources created within the object are closed and the form is
disposed." Unless you are seeing some type of issue in your application I
would say that what you've pseudocoded wouldn't be that necessary. Just
close forms when you're done with them.
 
Tim Wilson said:
In the help file for Form.Show() it indicates that "when a form is closed,
all resources created within the object are closed and the form is
disposed." Unless you are seeing some type of issue in your application I
would say that what you've pseudocoded wouldn't be that necessary. Just
close forms when you're done with them.


OK, thanks Tim.


Steve
 
Back
Top