473,395 Members | 1,949 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,395 software developers and data experts.

How do I tell i

Because I am developing a high-speed data entry form that focuses on 10-key,
the users want to have the "+" key on the 10-key pad function as a "tab"
key. I would like to trap this in the textform TextChanged event and do a
SelectNextControl in order to simulate the behavior, but don't know how to
check for the "+" key.

Does anyone know how to do this?

Example:

private void txtTest1_TextChanged(object sender, System.EventArgs e)
{
// Want to test for "+" key pressed here.
}
Nov 15 '05 #1
3 1434
You can do it with the KeyDown event

public void txtTest1_KeyDown(object sender, System.KeyEventArgs e)
{
if(e.KeyData == Keys.Add)
{
// take whatever action, it would the numpad +
// the regular + is Keys.OemPlus I think
}
}

--
The hotmail account will most likely not be read, so please respond only
to the news group.
Nov 15 '05 #2
Hi,

You will have to create a new class derived from the current control you
are using , this is needed in order to change the key readed, then you would
do something like:

public class FastEntryControl : TextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if ( (char)'+' == e.KeyChar )
//Create a new KeyPressEventArgs with the new key
base.OnKeyPress( new KeyPressEventArgs ( '\t\ );
else
base.OnKeyPress( e);
}
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Top Gun" <nf*@nospam.com> wrote in message
news:ep**************@TK2MSFTNGP10.phx.gbl...
Because I am developing a high-speed data entry form that focuses on 10-key, the users want to have the "+" key on the 10-key pad function as a "tab"
key. I would like to trap this in the textform TextChanged event and do a
SelectNextControl in order to simulate the behavior, but don't know how to
check for the "+" key.

Does anyone know how to do this?

Example:

private void txtTest1_TextChanged(object sender, System.EventArgs e)
{
// Want to test for "+" key pressed here.
}

Nov 15 '05 #3
This works, however it is typing a "+" into my textbox, which is not desired
behavior. Is there any way to prevent this and JUST do the tab?

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

You will have to create a new class derived from the current control you
are using , this is needed in order to change the key readed, then you would do something like:

public class FastEntryControl : TextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if ( (char)'+' == e.KeyChar )
//Create a new KeyPressEventArgs with the new key
base.OnKeyPress( new KeyPressEventArgs ( '\t\ );
else
base.OnKeyPress( e);
}
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Top Gun" <nf*@nospam.com> wrote in message
news:ep**************@TK2MSFTNGP10.phx.gbl...
Because I am developing a high-speed data entry form that focuses on

10-key,
the users want to have the "+" key on the 10-key pad function as a "tab"
key. I would like to trap this in the textform TextChanged event and do a SelectNextControl in order to simulate the behavior, but don't know how to check for the "+" key.

Does anyone know how to do this?

Example:

private void txtTest1_TextChanged(object sender, System.EventArgs e)
{
// Want to test for "+" key pressed here.
}


Nov 15 '05 #4

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

Similar topics

3
by: Jonathan | last post by:
Rather than me explain the problem, read this exchange of emails between my web host and myself, then tell me what I can tell them! I had a problem with their admin site all day, and after me...
8
by: Peter Abel | last post by:
Hi all, I'm working under W2k with Python 2.2.2 (#37, Oct 14 2002, 17:02:34) on win32 I have a file *test_data.txt* with the following content: 0123456789 0123456789 abcdefghi...
3
by: Pernell Williams | last post by:
Hi all: I am new to Python, and this is my first post (and it won't be my last!), so HELLO EVERYONE!! I am attempting to use "xreadlines", an outer loop and an inner loop in conjunction with...
3
by: N. Volbers | last post by:
Hello everyone, I noticed that when you open a zipped tarball using 'tarfile' and if you then get the pseudo-file descriptor fd for a file via 'extractfile', then fd.tell() is broken in the...
1
by: jazzMan007 | last post by:
Hi All - I'm using the new UrlMappings feature in an ASP.NET 2.0 application. I'm using the unique urls, mapped to shared files, in the site map. So for example, I have pages A, B, & C...all of...
13
by: Jiho Han | last post by:
Here's the issue. You have a class, Class Person { public int id; public string firstname; public string lastname; }
3
by: sara | last post by:
Hi - I have a button that runs 2 reports. If there is no data on the report, I use the No Data event, and tell the user, and Cancel the execution of that report. However, if the first report...
3
by: Magdoll | last post by:
I was trying to map various locations in a file to a dictionary. At first I read through the file using a for-loop, but tell() gave back weird results, so I switched to while, then it worked. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.