This is a winform C# question. I have a textbox with a validating event listener to validate the content of the textbox. Say, the textbox doesn't accept negative values. I only listen to validating event so by default, the textbox's AutoValidate property is EnablePreventFocusChange, which is totally fine for me.
The problem is, when I click the X button on the right top corner of the form, I don't want the validation to be fired because I am closing the form anyway. How can I do this? There is no control to set CauseValidation to false, which I can do if there is a closing button. Thank you very much.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…