dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Using SendKeys in C#

You can use SendKeys to send a different keycode from the one that was pressed.


advertisement

SendKeys is very powerful. You can use SendKeys to send a different keycode from the one that was pressed. For example:

private void TextBox1_KeyDown(object sender, KeyEventArgs e)
        {

            if (e.KeyCode == Keys.Right)
            {
                SendKeys.Send("{TAB}");
            }
            if (e.KeyCode == Keys.Left)
            {
                SendKeys.Send("+{TAB}");
            }

       }

"Presses" tab when the Left or Right arrow keys are pressed.

 

Visit the DevX Tip Bank

 



   
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date