Hello to all.

Please tell me how to pull the carriage when you press enter to the specified textBox. Example, as in the registration form, the user entered the string "name", pressed enter and the carriage went down to the next cell to enter information. Thank.

  • what is your framework? - DreamChild
  • @NMD thanks. I hope you have not found it difficult to answer this question :). Based on the comments of this question, everything turns out to be not so simple - Gennady Pisarev
  • @Gennadiy Pisarev: The question was about the graphic framework. For example, WPF or WinForms. Each of them solves this issue in its own way. And C # itself does not solve at all. - VladD
  • > For example, WPF or WinForms. Each of them solves this issue in its own way, plus it could be asp.net or asp, net mvc - there, too, it will look different. - DreamChild

1 answer 1

It is necessary to catch keystrokes in the textbox, and when Enter is pressed, execute {имя textbox'a}.Focus(); .

Like this:

  private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { textBox2.Focus(); } } 
  • @NMD Thank you, everything works, everything is fine. Because of this line of code here, a little bit of the third world would have started :). I only wonder why they didn’t hit me when I asked a question about a comment. - Gennady Pisarev