Why does this button close my form?
- Details
- Written by David Corrales
- Last Updated: 24 June 2016
- Created: 29 June 2015
- Hits: 16640
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.
For more information, see:
If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.