Enter the Enter key when the tab key is used

Source: Internet
Author: User

# Region enter key when the tab key is used
Private void enter_keypress (Object sender, keypresseventargs E)
{
Foreach (control C in this. Controls)
{
C. keypress + = new system. Windows. Forms. keypresseventhandler (sendenter );
}
}
Private void sendenter (Object sender, keypresseventargs E)
{
If (E. keychar = (char) keys. Enter)
{
// Make the buttons take effect
E. Handled = true;
// Send the key command
Sendkeys. Send ("{tab }");
}
}
# Endregion

 

Use the keychar attribute to sample the keys at run time and modify the keys in a specific runtime environment. For example, you can use keychar to disable non-numeric buttons when entering the zip code, and change all the letter buttons in the data input field to uppercase, you can also monitor the keyboard or other keys and enter the specific keys of the device.

You can obtain or set the following keys:

  •  

  •  

    A-Z, a-Z.

  •  

  •  

    CTRL.

  •  

  •  

    Punctuation.

  •  

  •  

    The top of the keyboard and the number key on the keyboard.

  •  

  •  

    Enter.

You cannot obtain or set the following keys:

    •  

    •  

      Tab key.

    •  

    •  

      Insert and delete.

    •  

    •  

      Home.

    •  

    •  

      End.

    •  

    •  

      Page up and page down.

    •  

    •  

      F1-F2.

    •  

    •  

      Alt.

    •  

    •  

      Arrow keys.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.