/// <summary> /// Selects the specified text section. /// </summary> public void Select(int start, int length) { int documentLength = Document != null ? Document.TextLength : 0; if (start < 0 || start > documentLength) { throw new ArgumentOutOfRangeException("start", start, "Value must be between 0 and " + documentLength); } if (length < 0 || start + length > documentLength) { throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + (documentLength - start)); } textArea.Selection = SimpleSelection.Create(textArea, start, start + length); textArea.Caret.Offset = start + length; }