您的位置:首页 > 其它

经过网上查找,终于找到了选中文本本框的内容方法

2008-05-18 10:46 369 查看
textBox2.Focus();
textBox2.SelectionStart = 0;
textBox2.SelectionLength = textBox2.Text.Length;
这是找到的代码, 自己要用做函数,就写了一下
private void button2_Click(object sender, EventArgs e)
{
SelectAll(textBox2);
}
public static TextBox SelectAll(TextBox TB)
{
TB.Focus();
TB.SelectionStart = 0;
TB.SelectionLength = TB.Text.Length;
return TB;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐