Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to change the tab button into enter button event?
Posted
Updated 12-May-11 22:32pm
v2
Comments
Sergey Alexandrovich Kryukov 13-May-11 5:17am    
Please clarify. Is that what lukeer means?
--SA

1 solution

If I understand you correctly, You want to change the input that some Control receives.

I would try that by subclassing the target Control and override its OnKeyDown event:
protected override void OnKeyDown(KeyEventArgs e)
{
    if ((e.KeyCode & Keys.Tab) != Keys.None)
    // "Tab" was pressed
    {
        e.KeyCode &= ~Keys.Tab;     // Forget "Tab"
        e.KeyCode |= Keys.Enter;    // Use "Enter" instead
    }

    base.OnKeyDown(e);
}
That should make the derived class act as if "Tab" was an "Enter" as well.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900