I’m working with VB.net.
I’m having problems while I connect my application to my database today so I wanted to add an error handling to close the form.
The problem is that when I put Me.close in a form, this form still open. I used the Form.Closing event handler to verify that it was called, and then ran my application in step by step which showed that the event handler was called, but the application continues and the errors appears to the user.
Does anyone knows how to close a form properly without closing the application?
Closewill close a form, but only if it has no more code to run.That is, there are two conditions that need to be fulfilled for a form to close:
Closemust be calledI suspect that another method is still running code, for instance a loop or other code that causes the form to remain open.
Furthermore, the form will get re-opened automatically once you start accessing its members form elsewhere, due to an infuriating property of VB to auto-instantiate forms.