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 Harmes
HiBit Technologies, Inc.