?
Solved

Automatic go to textbox2 when a user gives an enter in textbox1.

Posted on 2011-09-07
4
Medium Priority
?
521 Views
Last Modified: 2013-12-17
Hi,

I have 2 textboxes on my form, one is called textBox1 and the other is
called textBox2. I would like when a user is typing in textBox1 and presses
the enter-key it goes automaticly to textBox2.

How can I go from textBox1 to textBox2 after pressing the enter-key?

Who can help me and know the answer?

Greetings,

Peter Kiers
0
Comment
Question by:peterkiers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
Praveen_Bobbili earned 2000 total points
ID: 36494372
Hi,
Give the onkeypress event to textbox1

<input type="text" id="textbox1" onkeypress="optionkeypress(eve);"/>
function optionkeyress(evt)
{
     if(evt.keycode == 13)
       {
txtbox2.focus();
}
 
}
 
 
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36494400
I don't know if it's me but I don't know what I am doing wrong, but i get errors:

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (keycode == 13)
            {
                textBox2.focus();
            }
        }

Peter
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36494441
Gotit:

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                textBox2.Focus();

            }
        }

Greetings,

Peter Kiers
0
 
LVL 1

Expert Comment

by:Praveen_Bobbili
ID: 36494854
May be somewhere you got the conflict with other javascript. Try to do with error console in firefox.
0

Featured Post

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question