473,403 Members | 2,366 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,403 software developers and data experts.

Use Enter Key or Arrow Key as well as Tab Key

I have a client who wishes to use the Enter Key and/or Arrow Keys, as well as
the Tab Key, to navigate between Fields in a Windows form.

Is this possible using C# in Visual Studio 2000 ?
Nov 22 '05 #1
3 4979
Yes, you can use Control.KeyDown (or Control.KeyUp) event to accomplish
this.

ShaneB
"FredSP" <Fr****@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
I have a client who wishes to use the Enter Key and/or Arrow Keys, as well
as
the Tab Key, to navigate between Fields in a Windows form.

Is this possible using C# in Visual Studio 2000 ?

Nov 22 '05 #2
Look into KeyPreview, OnKeyPress.

KeyPreview instructs the framework to send you the keys pressed on the form.
OnKeyPress will allow you to see what key is pressed. You can then use the
following code to find the next control:

if (ActiveControl != null)
ActiveControl.GetNextControl(ActiveControl, true);

Don't forget to check for shift key. Pass false to the second param in that
case.

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy

"FredSP" wrote:
I have a client who wishes to use the Enter Key and/or Arrow Keys, as well as
the Tab Key, to navigate between Fields in a Windows form.

Is this possible using C# in Visual Studio 2000 ?

Nov 22 '05 #3
Using the form's KeyPreview will work....but using the KeyPress event will
not. He will need to use the KeyUp or KeyDown event instead.

From the online help:
"The KeyPress event is not raised by noncharacter keys; however, the
noncharacter keys do raise the KeyDown and KeyUp events."

ShaneB

"Alex Korchemniy" <Al************@discussions.microsoft.com> wrote in
message news:CA**********************************@microsof t.com...
Look into KeyPreview, OnKeyPress.

KeyPreview instructs the framework to send you the keys pressed on the
form.
OnKeyPress will allow you to see what key is pressed. You can then use the
following code to find the next control:

if (ActiveControl != null)
ActiveControl.GetNextControl(ActiveControl, true);

Don't forget to check for shift key. Pass false to the second param in
that
case.

---
This posting is provided "AS IS" with no warranties, and confers no
rights.
Alex Korchemniy

"FredSP" wrote:
I have a client who wishes to use the Enter Key and/or Arrow Keys, as
well as
the Tab Key, to navigate between Fields in a Windows form.

Is this possible using C# in Visual Studio 2000 ?

Nov 22 '05 #4

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

Similar topics

3
by: FredSP | last post by:
I have a client who wishes to use the Enter Key and/or Arrow Keys, as well as the Tab Key, to navigate between Fields in a Windows form. Is this possible using C# in Visual Studio 2000 ?
9
by: ZorpiedoMan | last post by:
This is so weird, and I cannot even isolate the cause enough to give any clues as to how to reproduce the error, so this is probably a real shot in the dark... BUT, has anyone ever run into a...
4
by: Neil Wallace | last post by:
Hi there, I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel. They are added in runtime, and so they adopt a...
6
by: Bruce D | last post by:
I have a datagrid (uggg) that I use and create the columns programmatically...see below. objCol = New DataGridTextBoxColumn objCol.MappingName = "amount" objCol.HeaderText = "Amount"...
4
by: almurph | last post by:
Hi everyone, I'm a newbie to javascript. I have written some code to detect when a user presses the down-arrow, up-arrow and enter button. Essentially the user can arrow down or up through a...
1
by: almurph | last post by:
Hi everyone, I'm a newbie to vb.net. I have written some code to detect when a user presses the down-arrow, up-arrow and enter button. Essentially the user can arrow down or up through a...
3
by: Bob Sanderson | last post by:
I have a PHP web page which uses a HTML form. I would like to enter dates into the date fields using a JavaScript calendar, similar to the way phpMyAdmin does. Can anyone recommend a JavaScript...
7
by: Rotsey | last post by:
Hi, I am having a problem trying to select an item with the enter key. I want to work the combo with the keyboard. So when I use the down arrow to browse the list I want to then hit the...
1
by: LazarusHC | last post by:
I'm currently trying to learn perl as well as perl curses. I found this script, and I understand why it's supposed to work, but I don't understand why it doesn't. The idea is that pressing "enter"...
4
by: beary | last post by:
Hi Being tested using FF 3 on WAMP server. I have spent a number of hours trying to figure this out myself. I have a html form using table cells and had a request to enable the arrow keys on a...
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
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,...

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.