Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to select second textbox when press "Enter" on first textbox in c#

thank u a lot
Posted

1 solution

Hi,
You need to use the Key_Press event.
After that, you may set the focus to the second textbox.

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



regards
 
Share this answer
 
Comments
afshin.b.k 26-Jul-10 5:18am    
Reason for my vote of 5
thats right in a top of my needs
Ankur\m/ 26-Jul-10 5:20am    
Reason for my vote of 5
Correct answer!
Ramya 2010 27-Jul-10 5:45am    
Reason for my vote of 5
Exact Answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900