473,729 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox Event Firing Order/Cancel

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
8 3480
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*@discussion s.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
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*@discussion s.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
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*@discussion s.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
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*@discussion s.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
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*@discussion s.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*@discussion s.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
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*@discussion s.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*@discussion s.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
"EdB" <Ed*@discussion s.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
"EdB" <Ed*@discussion s.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3785
by: Maxine G | last post by:
I have two forms, a menu and a data entry form. The entry form is bound to a query against linked SQL server tables. In the deactivate event, I have some code which asks the user if they want to save their changes and they can respond with yes, no or cancel. If they press cancel, the entry form stays active with the changes still entered. So, if I'm on the entry form and have entered data, and then click on the menu, the deactivate event...
4
2608
by: DebbieG | last post by:
I have a form based on this query: SELECT Students.LastSerDT, OtherInfo.Served, OtherInfo.HSGradYr, OtherInfo.ActivePart, OtherInfo.Served, Students.SSN, & ", " & & " " & AS Name, Students.LastNM, Students.FirstNM, Students.MI, Students.DOB, Students.GenderCD, Students.EthnicityCD, Students.EligibilityCD, Students.UBInitiative, Students.NCESSchID, Students.ProjEntryDT, Students.ProjReEntDT, Students.LastSerDT, Students.Reason,...
1
4280
by: David Smith | last post by:
What I want to be able to do: A textbox is available that the user can enter information into. Specifically (for the purposes of this post), the user is asked to enter a number, and that number has an upper limit. I want to do validation on what the user enters as they type it in. I set up an event handler for KeyPress that restricts them from being able to enter non-numeric characters (only allowing numbers, decimal point, control...
7
7773
by: | last post by:
Hello to all I'm handling the Validating event for one text box. If something is wrong in user input I show a warning message. The problem is that if I add to method the message is displayed twice (event fired twice). Without event is fired once. if(txtMSG.Length > 0) {
11
7763
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and the web server performs a database query and displays the results. All of this works fine. I want the user to be able to press the Enter key while the cursor is still in SearchTextBox and have the SearchButton.Click event fire (thus performing...
0
314
by: EdB | last post by:
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.
17
10212
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
21
9217
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button is the Cancel button. WHen the user clicks on the cancel button, the textbox.validating is being called. I don't want it to be since they are exiting the screen the validation doesn't have to be done. How can I do that.
2
1574
by: Luqman | last post by:
I have coded in Textbox_changed Event: If CType(txtVoucherNo.Text, Long) = 0 Then Me.DetailsView1.ChangeMode(DetailsViewMode.Insert) Me.DetailsView1.AutoGenerateInsertButton = True Me.DetailsView1.AutoGenerateEditButton = True
0
8764
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9156
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6026
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3242
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2694
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.