Nitin Kabra
Nitin Kabra

Reputation: 3246

Stop textbox leave handler on click of exit button?

I have a form where I do some validations in a textbox and a button for closing the form. Now whenever I click the button and focus is on text box, the leave handler is called.

How can I stop textbox leave handler from executing ?

update :

The text of button in E&XIT, now whenever I press Atl + X it calls the button click event, but when I click on the button it doesn't. Why is it happening ?

Thanks.

Upvotes: 0

Views: 815

Answers (1)

Hans Passant
Hans Passant

Reputation: 942508

Use the Validating event instead of the Leave event. Set the button's CausesValidation property to False.

Upvotes: 1

Related Questions