记事本编辑菜单项的查找用C#怎么实现啊,大虾们,帮帮忙啊!界面做好了,不知道该怎么实现啊!

解决方案 »

  1.   

    int s = this.textBox1.SelectionStart;
                if (this.textBox1.SelectedText == "要查找的内容")
                {
                    s++;
                }
                int result = this.textBox1.Text.IndexOf("要查找的内容", s);
                if (result >= 0)
                {
                    this.textBox1.SelectionStart = s;
                    this.textBox1.SelectionLength = "要查找的内容".Length;
                    this.textBox1.ScrollToCaret();
                }
                else
                {
                    MessageBox.Show("没找着");
                }
      

  2.   

    修正一下:
    int s = this.textBox1.SelectionStart;
                if (this.textBox1.SelectedText == "要查找的内容")
                {
                    s++;
                }
                int result = this.textBox1.Text.IndexOf("要查找的内容", s);
                if (result >= 0)
                {
                    this.textBox1.SelectionStart = result;
                    this.textBox1.SelectionLength = "要查找的内容".Length;
                    this.textBox1.ScrollToCaret();
                }
                else
                {
                    MessageBox.Show("没找着");
                }