1

This isn't really a big problem but I have been using the Close(); statement to well make the app close or have a button that closes the program with this function. However recently I saw someone use Application.Exit(); to do the same I guess. I just wanna know how these two are different. Or are they the same?

I haven't tried the Application.Exit(); statement yet. I just wanna know the difference because I am basically just a beginner.

  • Welcome to Stack Overflow! As advice to beginners programmers and for new contributors to the site, it's important to do some research first. For instance, simply copy-pasting the (well-phrased) title of the question into a search engine gives several relevant results, among others some existing Q&A here: https://stackoverflow.com/questions/13046019/winforms-application-exit-vs-environment-exit-vs-form-close https://stackoverflow.com/questions/16815021/difference-between-form-close-and-application-exit – Pac0 Dec 03 '22 at 10:19

1 Answers1

0

It has been 10 years that I have not used windows forms but as far as I remember: Close, closes the current form. Just if the current form is the application main form, this will cause the application to exit. Application.Exit() could be called anywhere in any form and it causes application termination.

MD Zand
  • 2,366
  • 3
  • 14
  • 25