By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,451 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

TextBox Event Firing Order/Cancel

P: n/a
EdB
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.
Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
EdB,

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

http://groups.google.com/groups?selm...TNGP12.phx.gbl

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

"EdB" <Ed*@discussions.microsoft.com>
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.

Nov 21 '05 #2

P: n/a
EdB,

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

http://groups.google.com/groups?selm...TNGP12.phx.gbl

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

"EdB" <Ed*@discussions.microsoft.com>
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.

Nov 21 '05 #3

P: n/a
EdB
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.

"Cor Ligthert" wrote:
EdB,

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

http://groups.google.com/groups?selm...TNGP12.phx.gbl

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

"EdB" <Ed*@discussions.microsoft.com>
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.


Nov 21 '05 #4

P: n/a
EdB
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.

"Cor Ligthert" wrote:
EdB,

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

http://groups.google.com/groups?selm...TNGP12.phx.gbl

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

"EdB" <Ed*@discussions.microsoft.com>
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.


Nov 21 '05 #5

P: n/a
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" <Ed*@discussions.microsoft.com>
....
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.

"Cor Ligthert" wrote:
EdB,

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

http://groups.google.com/groups?selm...TNGP12.phx.gbl

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

"EdB" <Ed*@discussions.microsoft.com>
>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.


Nov 21 '05 #6

P: n/a
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" <Ed*@discussions.microsoft.com>
....
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.

"Cor Ligthert" wrote:
EdB,

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

http://groups.google.com/groups?selm...TNGP12.phx.gbl

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

"EdB" <Ed*@discussions.microsoft.com>
>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.


Nov 21 '05 #7

P: n/a
"EdB" <Ed*@discussions.microsoft.com> schrieb:
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'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #8

P: n/a
"EdB" <Ed*@discussions.microsoft.com> schrieb:
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'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.