Home > php教程 > php手册 > C#TextBoxCtrl A select all

C#TextBoxCtrl A select all

WBOY
Release: 2016-07-06 13:30:26
Original
1795 people have browsed it

When using shortcut keys in the TextBox control, it is generally required to press the shortcut key to produce an effect immediately. The KeyUp event obviously does not meet our requirements, and the KeyPRess event does not support the use of assemblies, so we choose the KeyDown event. The specific code implementation is as follows : private void tBBefore_KeyDown( object sender, KeyEventArgs e){ if (e.Co

When using shortcut keys in the TextBox control, it is generally required to press the shortcut key to produce an effect immediately. The KeyUp event obviously does not meet our requirements, and the KeyPRess event does not support the use of assemblies, so we choose the KeyDown event. The specific code implementation is as follows :

<span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> tBBefore_KeyDown(<span style="color: #0000ff">object</span><span style="color: #000000"> sender, KeyEventArgs e)
{
    </span><span style="color: #0000ff">if</span> (e.Control && e.KeyCode ==<span style="color: #000000"> Keys.A)
    {
        ((TextBox)sender).SelectAll();
    }
}</span>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template