473,796 Members | 2,628 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 4995
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
1292
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
5892
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
3312
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
2345
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
10361
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
6286
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
9673
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
9524
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
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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
5440
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
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.