"VB.net" text box shortcut key support

Source: Internet
Author: User

We know that the text box in vb.net is a shortcut key that does not support CTRL + A.

What if we let it support it?

1     Private SubTxtsql_keydown (ByValSender as Object,ByValE asSystem.Windows.Forms.KeyEventArgs)HandlesTxtsql.keydown2         IfE.keycode = KEYS.AAndAlso(E.keydata andKeys.control) Then3             'Select All4 Txtsql.selectall ()5         End If6     End Sub

The above code is an example.

E.keycode is the code that you press for the character class key, for example: a,b,c,1,2,3,;, ', [, and so on.

E.keydata means that you press the character-class key code encoded with the function key (such as ctrl,alt,shift, etc.) encoded in combination.

The e used here. KeyData and Keys.control are trying to get from E. Keydata extracts the CTRL key in the code, if the extraction succeeds, it means that the combination key is pressed, otherwise it is not pressed key combination.

In this example, the key combination of CTRL + A is checked, so the effect of caption description is achieved.

"VB.net" text box shortcut key support

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.