Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looking for a way to use ENTER to move between controls
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01378498
Message ID:
01379659
Views:
33
This message has been marked as the solution to the initial question of the thread.
>In FoxPro, there was a setting that would allow users to move between controls using either ENTER or TAB, as they had in DOS. I have an application which has quite a few numbers to be entered and the users would like to be able to use the enter key after entering the numbers because they use the number pad for entry. I tried using some code in my base form class that would trap the ENTER key stroke and replace it with a TAB but that causes problems when the field is a multi-line text box and the ENTER key needs to behave as an ENTER key. Is there some setting for this or should I just build a custom numeric control that traps the ENTER key? Thanks.
>
>I tried doing a custom control, adding the following override for the OnKeyPress event:
>
>
>        protected override void OnKeyPress(KeyPressEventArgs e)
>        {
>            switch (e.KeyChar)
>            {
>                case '\r': // enter key
>                    e.Handled = true;
>                    base.OnLeave(e);
>                    break;
>                default:
>                    base.OnKeyPress(e);
>                    break;
>            }
>        }
>
>
>It still just ignores the ENTER key. I had hoped to force a TAB keystroke when ENTER is pressed but apparently you can't trap or force a TAB key using KeyChar. Any ideas?

Linda,

Check this out:

http://blog.gadodia.net/windows-forms-simulate-tab-with-enter-key/

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform