Have you ever copied a button and found that when a user presses it, the form closes immediately afterwards? We are here to answer:
Why does this button close my form?
The reason the form closes is that the Button control’s DialogResult property is set to a value other than None. This property tells the form to close after the user has clicked the button without you having to explicitly close the form in the button’s click event script block.
So next time you copy an OK or Cancel button, be sure to set the button’s DialogResult to None.
Please refer to the following article for more details on the button control and the DialogResult property:
https://www.sapien.com/blog/2011/06/07/primalforms-2011-spotlight-on-the-button-control/
Follow @SAPIENTech
![[Google+]](http://www.sapien.com/blog/wp-content/uploads/GooglePlus.gif)