is there a way to disable the validation of errorprovider elegantly when click cancel button to dismiss a winform? The validation always happens when the textbox lose focus, and i don't wanna it to validate when the user click cancel button, it is just a little bit silly to validate when the user clicking cancel.
相关问题
- How do I bind a DataGridViewComboBoxColumn to a pr
- Partial Form Class C# - Only display code view for
- Can we add four protocols to ServicePointManager.S
- How to properly handle form closing when using bac
- Filter Datagridview rows using TextBox
相关文章
- Sort TreeView Automatically Upon Adding Nodes
- Where does this quality loss on Images come from?
- Missing partial modifier on declaration of type
- PropertyGrid - Possible to have a file/directory s
- Why do base Windows Forms form class with generic
- How to handle the TextChanged event only when the
- Difference between SuspendLayout and BeginUpdate
- Adding Combobox to DataGridView Headers
after googling, found the answer, just set CauseValidation property of the cancel button to false. that's it.
I just ran into this myself and setting
CauseValidation = false
is only a partial solution.When you set the
Form.CancelButton
to the cancel button, the Escape key is supposed to invoke that button. It does, however, validation still runs in response to the Escape key, even though we setCauseValidation = false
.To fix it, add the following hack: