473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Getting text box value on key press?

I have three text boxes on a form with one button. The button is the
form's AcceptButton. After some one puts a value into any text box, I
assign the value to an object via textbox.Leave() event. This doesn't
work if some one types or pastes in a value then hits <enter>. None of
the key events are captured. The button click event is fired.

I could just capture textbox values in the search button click event.
However, I'd like to get them in real-time. Another option is to
capture on keyup() so that I get values as the user types them. That's
to much overhead and inefficient should I want to make use of those key
events for something. I also need to capture a pasting values into the
textbox.

Any suggestions?

Thanks,
Brett

Mar 10 '06 #1
4 3270
I would use the Change event if i were you, it should work much better :)

- Mark

On Fri, 10 Mar 2006 10:27:24 +0800, Brett Romero <ac*****@cygen.com> wrote:
I have three text boxes on a form with one button. The button is the
form's AcceptButton. After some one puts a value into any text box, I
assign the value to an object via textbox.Leave() event. This doesn't
work if some one types or pastes in a value then hits <enter>. None of
the key events are captured. The button click event is fired.

I could just capture textbox values in the search button click event.
However, I'd like to get them in real-time. Another option is to
capture on keyup() so that I get values as the user types them. That's
to much overhead and inefficient should I want to make use of those key
events for something. I also need to capture a pasting values into the
textbox.

Any suggestions?

Thanks,
Brett


Mar 10 '06 #2
Text boxes don't have a change event, at least in 2.0. Besides, you
would still execute that code upon each letter the user is typing in,
which I don't want. Probably works well only for pasting into the box.

Thanks,
Brett

Mar 10 '06 #3
Brett,

There is a TextChanged event in textboxes, and pasting text into the
textbox will fire this event.

I hope this helps ~ Justin

Mar 10 '06 #4
Justin,

That probably works fine when they paste into the box. But it will
still fire after every key press.

Brett

Mar 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
Hello, I'm currently using reflection to get some data from an assembly created from a web form that has elements such as a DataGrid, DataSet, etc. I also have a label control. Getting the...
1
by: Juba | last post by:
Hello, I have the following code placed at my Page_Load event and after the Datagrid is binded, so it is not empty. The problem is that the variable isclass is always returning null and I am...
4
by: John Rose | last post by:
I have one databound TextBox on a page with one button. The TextBox loads the correct SQL record data but typing a new string into the Textbox fails to change the DataSet. Any ideas? There must...
3
by: Dipendra Darbar via DotNetMonster.com | last post by:
Hi, I have created an AssetTracking database in SQL Server 2000 and one of my master tables generates an autonumber for a unique PC Make. For example my table will consist of the following: 1...
0
by: Italian Pete | last post by:
Hi, I'm tring to get hold of the text property of a cell in a datagrid: dg. I'm using dg.Items.Cells.Text but it is giving me nothing back. It works for a BoundColumn but not for a...
8
by: Raul | last post by:
Hi, I have a select list that gets populated from the DB. When the user makes a selection I am able to retrieve this value via Request.Form(...) However, I am wondering if you can retrieve...
1
by: Java Kumar | last post by:
Hi Pals, I need your help regarding following problem.Im working in MVC model application which has jsp, servlet,and bean file. By the flow of application , I have to display datas in jsp page...
1
by: cssExp | last post by:
hi consider the following html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
3
by: Promedeus | last post by:
.NET Version: 3.5 Ok, I recieve an error (System.InvalidCastException was unhandled. Message="Unable to cast object of type 'System.Windows.Forms.Control' to type 'System.Windows.Forms.Label'.")...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.