473,385 Members | 1,338 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,385 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 4975
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.