469,922 Members | 2,149 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

Using <Enter> or <NewLine> key instead of Tab

tor
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn
Nov 15 '05 #1
6 2257
Any particular reason why you wanna do that?

Benny

tor wrote:
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn


Nov 15 '05 #2
Torfinn,

In order to do this you can capture when the key that you want to shift
focus is pressed (using an event, overriding the WndProc method, etc, etc).
When the event that is supposed to shift the focus occurs, call the
GetNextControl method on the current control and then call Focus on the
control returned.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"tor" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn

Nov 15 '05 #3
The best solution is probably to handle the myTextBox.KeyDown event, check
the KeyCode property on the event argument, and if it's KeyCode.Enter, set
the focus on the next text box you want with myNextTextBox.Focus() and set
e.Handled to true.

Chris

"tor" <to******@hotmail.com> wrote in message
news:#c**************@TK2MSFTNGP11.phx.gbl...
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn

Nov 15 '05 #4
"Paul E Collins" <fi******************@CL4.org> wrote:
Or, instead of doing this for each control on the form,
set Form.KeyPreview = true and do something like the
above in Form_KeyDown.


Btw, ProcessTabKey would be helpful here.

P.

--
www.CL4.org
Nov 15 '05 #5
"tor" <to******@hotmail.com> wrote in news:#cninj6cDHA.3948
@TK2MSFTNGP11.phx.gbl:
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn


http://www.syncfusion.com/faq/winforms/search/902.asp

FB

--
Solutions Design : http://www.sd.nl
My open source .NET Software : http://www.sd.nl/software
My .NET Blog : http://weblogs.asp.net/FBouma
-------------------------------------------------------------------------
Nov 15 '05 #6
I needed to do this for a client recently to allow really fast data entry on
a form:

Set the KeyPreview property on the form to 'true'

Add the following code to the KeyPress event of the Form:

if(e.KeyChar == (char)13)
{
SendKeys.Send("{TAB}");
}

---
Steven Wood

"tor" <to******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn

Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

31 posts views Thread by da Vinci | last post: by
4 posts views Thread by aurgathor | last post: by
6 posts views Thread by scottyman | last post: by
14 posts views Thread by EnjoyNews | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.