473,804 Members | 3,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4997
Yes, you can use Control.KeyDown (or Control.KeyUp) event to accomplish
this.

ShaneB
"FredSP" <Fr****@discuss ions.microsoft. com> wrote in message
news:1D******** *************** ***********@mic rosoft.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.G etNextControl(A ctiveControl, 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.mi crosoft.com> wrote in
message news:CA******** *************** ***********@mic rosoft.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.G etNextControl(A ctiveControl, 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
532
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
1296
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 situation where pressing the enter key on a textbox control is NOT captured by the KeyPress event? Now before you ask: -- The form does NOT have a default button selected.
4
5895
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 sensible tab value. The tab key moves the focus down the column one by one, and the up and down arrow keys work well.
6
3314
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" objCol.Width = 60 objCol.Format = "C" objDGTS.GridColumnStyles.Add(objCol) ' create keypress, validating events for this textbox column only Dim dgtb As DataGridTextBox = CType(objCol.TextBox, DataGridTextBox)
4
4864
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 list and the textbox is populated with the option when the user presses the enter button. This is for a VB.NET Web form type project. The problem is that when I press the enter button the entire form get
1
2347
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 list and the textbox is populated with the option when the user presses the enter button. This
3
4496
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 that will do this? Also, how can I add a button to a form to enter a NULL. Thanks in advance.
7
10364
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 enter key as if selecting an item with the mouse. How do I do this?
1
1840
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" selects one of the menu entries, and if any other key is pressed, is prints "Character pressed is $c". The numbers work as expected, but if you press a letter, it acts like you've pressed enter. #!/usr/bin/perl # # Copyright (C) 2003 by...
4
6287
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 keyboard to move through the cells. I found some code and adapted it, and it works well now. Arrow keys move the cursor exactly to the correct cell. There are two things I can't do which I was hoping you guys would give me some help on. I am a...
0
9710
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
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
10085
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...
0
9163
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6858
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
5527
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...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
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
3
3000
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.