By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,839 Members | 2,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,839 IT Pros & Developers. It's quick & easy.

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

P: n/a
tor
Hello
How can I use an other key then TAB to move from
one textBox to another??

Torfinn
Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
"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

P: n/a
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.