请问怎么使文本框里的内容变成选中状态
比如说,在文本框中填如内容后觉得不满意,点击一个控件后从新填写,这时候希望原来的内容变成选中状态,怎么写啊???
各位指一下,谢谢

解决方案 »

  1.   

    试一下下面代码:
    textBox1.Focus();
    textBox1.SelectionStart=1;
    textBox1.SelectionLength=textBox1.Text.Length;
      

  2.   

    对不起,写错了,应该是:
    textBox1.Focus();
    textBox1.SelectionStart=0;
    textBox1.SelectionLength=textBox1.Text.Length;
      

  3.   

    textBox1.Select(0,1);//选种索引和长度
    textBox1.SelectAll();
      

  4.   

    ============================================
    serversql(啊初):
    textBox1.Select(0,1);//选种索引和长度
    textBox1.SelectAll();
    =============================================
    应该是这样:
    textBox1.Select();  //激活控件
    textBox1.SelectAll();
    此方法和我上面提出的方法(使用SelectionStart和SelectionLength)都可以实现你要的功能。