I have a winforms app, and in my app, i have a custom form I created. This custom from has the default close, minimize, and maximize buttons in the top right corner. If I close the form using the default red x button, it closes fine with no problems. However, if I try to close the form by calling .Close() on the form, it throws an unhandled InvalidOperationException exception.
What is the difference between calling .Close(), and clicking that button? Why does clicking the button work fine, but calling .Close() throw the exception?