private void gotoNextSentence() { var sentence = getNextSentence(); if (sentence != null) { setCaretPosAndSelect(sentence.Start, sentence.Length); } else if (textBox1.Text.Length > 0) { setCaretPosAndSelect(textBox1.Text.Length); } }