HOW TO USE ENTER KEY? WHEN AM USING TWO TEXTBOX THEN TO ENTER THE KEY AUTOMATICALLY GOTO NEXT FORM. THIS TIME AM NOT USING TAB OR MOUSE ??
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Wim SturkenboomRank #2,527 · 554 reputationPosted Oct 22, 2014, 11:18 PM EDT
For a windows forms application (not 100% clear from your description), below a little demo
private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
char x = (char)e.KeyValue;
if (x == 0x0A)
{
MessageBox.Show("0x0A", "KeyDown");
e.Handled = true;
}
if (x == 0x0D)
{
MessageBox.Show("0x0D", "KeyDown");
e.Handled = true;
}
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
char x = e.KeyChar;
if (x == 0x0A)
{
MessageBox.Show("0x0A", "KeyPress");
e.Handled = true;
}
if (x == 0x0D)
{
MessageBox.Show("0x0D", "KeyPress");
e.Handled = true;
}
}
0x0D seems the right one for
Note: please use decent titles for your threads.
VulpesRank #55 · 29.2K reputationPosted Oct 23, 2014, 2:50 AM EDT
Lawrence Pond149 reputationPosted Oct 26, 2014, 8:49 PM EDT
If you are using ASP.NET you could do the following
ID="MainPanel" runat="server" DefaultButton="btnGoToNextForm"> > Then wire up the btnGoNetForm clicked event will be triggered when the user presses enter in one of the two textbox fields.