How to prevent validating from being fired when I click X (Close button) on the form

前端 未结 3 1484
礼貌的吻别
礼貌的吻别 2020-12-20 05:38

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

3条回答
  •  别那么骄傲
    2020-12-20 06:07

    I solved this issue by setting the form CausesValidation property to False. The form now closes normally when I click the X button.

提交回复
热议问题