You can hook into the
PreviewKeyDownEvent
on your
RichTextBox
and then focus the next control if the pressed key is
Enter and the
RichTextBox
has three lines;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void richTextBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) {
if (e.KeyCode == Keys.Enter && richTextBox1.Lines.Count() == 3)
{
button1.Focus();
}
}
}
}
Hope this helps,
Fredrik