我想选择文本框中包含的所有文本。
我已经尝试使用下面的代码:
textBoxResults.SelectionStart = 0;
textBoxResults.SelectionLength = textBoxResults.Text.Length;
来源:我从这里http://msdn.microsoft.com/zh-cn/library/vstudio/hk09zy8f(v=vs.100).aspx获得了此代码,但由于某种原因,它似乎无法正常工作。
您可以为此使用内置方法。
textBoxResults.SelectAll();
textBoxResults.Focus(); //you need to call this to show selection if it doesn't has focus
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句