private void ErrorBox2_OnGoToErrorPositionEvent(object sender, EventArgs e) { TextBox2.Focus(); if (_errorPosition2 == -1) { return; } if (TextBox2.LineCount != 1) { TextBox2.ScrollToLine(TextBox1.GetLineIndexFromCharacterIndex(_errorPosition2)); } TextBox2.CaretIndex = _errorPosition2; }