using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NotePad
{
    public partial class frmGoTo : Form
    {
        public frmGoTo()
        {
            InitializeComponent();
        }
      
        private void button1_Click(object sender, EventArgs e)
        {
            int line = Int32.Parse(txtLine.Text);
            int index = (Application.OpenForms["Form1"].Controls["richTextBox1"] as RichTextBox).GetFirstCharIndexFromLine(line - 1);
            (Application.OpenForms["Form1"].Controls["richTextBox1"] as RichTextBox).Select(index, 0);
            (Application.OpenForms["Form1"].Controls["richTextBox1"] as RichTextBox).Focus();
        }
    }
}
