TextBox Event Firing Order/Cancel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am testing in a TextBox KeyPress event to validate characters in the
TextBox. How do I tell it to abort appending my "e" if I deem the character
invalid. I note that on a Form Closing event, e offers a Cancel. Not on a
textbox.
 
EdB,

You are doing a test for what I made a sample as is in this message.

http://groups.google.com/[email protected]

Watch as well that I used the KeyUp event and as well that validating event
otherwise you have done everything for nothing when a user just leaves the
textbox.

I hope this helps?

Cor
 
That definately helped Cor, thanks.

One suggestion, if I may, on your sample. In the validation routine, you
re-test the contents of the TextBox for all the same issues. In the sample,
the check is simple enough, but were it to be more complex....

I Dimmed a boolean at the top that set whether an error was found in the
KeyUp, then in the Validation, just checked that.
 
EdB,

I am glad it helps you.

In fact it are two samples which I now show in one, I have never thought
optimizing it, maybe I do it next time.

Thanks for your suggestion.

:-)

Cor
 
EdB said:
I am testing in a TextBox KeyPress event to validate characters in the
TextBox. How do I tell it to abort appending my "e" if I deem the
character
invalid.

'e.Handled = True'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top