private void button2_Click(object sender, EventArgs e)
        {
            this.textBox1.Focus();
            this.textBox1.Select(1, 2);
        }

解决方案 »

  1.   

    textBox.SelectionStart标示出来当前光标的位置,根据位置判断当前分割的文本内容,然后用Select方法选中即可。
      

  2.   

    2.0 直接使用 MaskedTextBox 控件就可...
      

  3.   

    设置参照:this.maskedTextBox1.PromptChar = ' ';
    this.maskedTextBox1.Mask = "AAA;AAAA;AAAA;AAAA";
      

  4.   

    试了下,这样写:
    private void textBox1_MouseDown(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left)
                {
                    //分隔符
                    string splitSymbol = ";";
                    //获取当前光标索引
                    int currentIndex = textBox1.SelectionStart;
                    //如果当前光标所在位置对应字符为分隔符,刚退出
                    if (currentIndex < textBox1.Text.Length && textBox1.Text[currentIndex].ToString() == splitSymbol)
                        return;                int beginIndex;//选中文本起始下标
                    int endIndex;//选中文本结束下标
                    beginIndex = textBox1.Text.LastIndexOf(splitSymbol, currentIndex) + 1;
                    endIndex = textBox1.Text.IndexOf(splitSymbol, currentIndex);
                    if (beginIndex < 0)
                    {
                        beginIndex = 0;
                    }
                    if (endIndex < 0)
                    {
                        endIndex = textBox1.Text.Length;
                    }
                    //选中文本
                    textBox1.Select(beginIndex, endIndex - beginIndex);
                }
            }
      

  5.   

    楼上说的很清啦,
    使用 //分隔符 
      string   splitSymbol   =   ";"; 
     //获取当前光标索引 
    这种方式还是不错的,举一反三!