473,395 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

leaving textbox on pressing enter key

Hello!!!!!!!!!!!

I am beginner, can you please help me with the following problem?

I have a form with 3 textboxes - txtBox1,txtBox2,txtBox3
on form load focus is on txtbox1

after i enter the data in txtBox1 I have to go to another txtBox2 either by pressing tab or by mouse.

I want to go to textbox2 by pressing enter key after I finish entering data in txtbox1.

How to do so?

Thanks in advance for your help.

Warm Regards,
Manisha Gandhi
Nov 8 '11 #1
1 1470
IronRazer
83 64KB
Hello ManishaGandhi,
I have used this in my programs before so i know it works. You can get the effect your looking for using Focus().

Try This :
Expand|Select|Wrap|Line Numbers
  1.     Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
  2.         If e.KeyValue = 13 Then TextBox2.Focus()
  3.     End Sub
  4.  
  5.     Private Sub TextBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
  6.         If e.KeyValue = 13 Then TextBox3.Focus()
  7.     End Sub
  8.  
Where 13 is the ASCII code for the enter key.
Jan 19 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: T.E. | last post by:
Hi all, I'm a newbie in php. I encounter a problem with php form that has only one textfield. If I click on the submit button, the form works fine. However, when I press 'enter', the form...
10
by: mg | last post by:
I want to enter characters in a TextBox in a WebForm, press a Button in the WebForm, and read the characters that were typed into the TextBox from within the Button_Click event handler. The main...
4
by: Jerry | last post by:
Hello I have some textboxes (input type=Text) in a Form. In some Forms if I Press Enter while I am in the Textbox It causes a Submit. The input type is text not submit. It's obsure that the...
2
by: Fernando Lopes | last post by:
Hi. I one usercontrol, i have a zipcode textbox . I need to, when user press ENTER, I call a code-behind method, to check this zipcode on database and, depending the return of this check,...
1
by: George Homorozeanu | last post by:
Hi, I have an ASP.Net Page with some control on it (buttons, textboxes, calender, etc). When I'm changing the text in the textbox I want to run some code and change the date of the calendar. The...
9
by: Camellia | last post by:
Hi all, I'll get straight into it. When I try to run the code: ..... while (scanf("%c", &c) == 1) printf("%c", c); ..... I input "abcd" follows by an EOF(Ctrl + d) instead of pressing...
1
by: Camellia | last post by:
Hi all, I'll get straight into it. When I try to run the code: ..... while (scanf("%c", &c) == 1) printf("%c", c); ..... I input "abcd" follows by an EOF(Ctrl + d) instead of pressing...
2
Soniad
by: Soniad | last post by:
Hello, I am having ASP page, in this there in one textbox to enter emailid ,I have done javascript validation for this i.e. if email id is not valid then alert message is shown and page will not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.