[winforms]swiching focus with ENTER key

P

peter

Hi!
I have a many forms with many controls and users are used to use ENTER
key to move/circle through controls on a form. How do i do that without
refferencig all controls on a form to a function?

Thankyou!
 
F

Frans Bouma [C# MVP]

peter said:
Hi!
I have a many forms with many controls and users are used to use ENTER
key to move/circle through controls on a form. How do i do that
without refferencig all controls on a form to a function?

You've to use this: (this is an example of the keydown event handler
of the textbox _fooTextBox)

private void _fooTextBox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
}

FB


--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top