Me.Close does not work

前端 未结 3 876
野的像风
野的像风 2021-01-19 01:57

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

3条回答
  •  無奈伤痛
    2021-01-19 02:16

    Close will 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:

    • Close must be called
    • Any method still running must be left

    I 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.

提交回复
热议问题