Tab key and keydown, keyup event

Source: Internet
Author: User

I saw a problem in the forum today, so I studied it carefully. The problem is about the tab key, keydown, and keyup events!

For example, if you have a Textbox Control and press tab in the case of focus, the keydown event is not triggered, but the input focus is directly removed! In other words, the tab key cannot be captured:

Private void textbox1_keydown (Object sender, keyeventargs E)
{
E. Handled = true;
Textbox2.text = E. keyValue. tostring ("X ");
}

But it is interesting that this key can trigger the keyup event that receives the focus. For example, you press the tab key in textbox1 and then textbox2 gets the input focus, you can capture this key in the keyup event of textbox2:
Private void textbox2_keyup (Object sender, keyeventargs E)
{

This. textbox2.text = E. keyValue. tostring ("X ");

}

You can try it!

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.