>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