Example #1
0
        public void GoToLine()
        {
            var gtlForm = new GoToLineForm();

            if (gtlForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (gtlForm.line.Value <= mainTextBox.Lines.Length)
            {
                mainTextBox.SelectionStart = 0;
                for (int i = 0; i < gtlForm.line.Value - 1; i++)
                {
                    mainTextBox.SelectionStart += mainTextBox.Lines[i].Length + 2;
                }
                mainTextBox.Focus();
            }
            else
            {
                MessageBox.Show(Messages.GotoError);
            }
        }