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

C#TextBoxCtrl A select all

WBOY
WBOYOriginal
2016-07-06 13:30:261789browse

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>

Statement:
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