Reputation: 865
I have a small problem. I have a TextBox myTxt. I set the myTxt_Leave event to check the database if input value already exists. If value exists, I display a MessageBox and set myTxt.Focus(). That wont let user to leave this TextBox, until another value (which does not exist in the database) is input.
But here is the catch...I would like to allow user to click on Cancel button on the form even if the value does not change. Is that possible? Hope someone understands what I wanted to tell.
Thank you for any help.
EDIT: I decided to change the interface a little. I put red label under the textbox "Value already exists" and disabled the Submit button until the value is correct.
But still, I'm curious if solution for my previous problem is possible?
Upvotes: 0
Views: 149
Reputation: 268
Instead of binding the event to the Leave interaction, just Highlight the box in red and disable the submit. When the when the error is resolved or the action is cancelled, clear the red / disabled submit button.
Upvotes: 2