Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to highlight then copy/cut a textbox? 1

Status
Not open for further replies.

interval

Programmer
Jun 16, 2000
3
0
0
US
How can I highlight a string in a textbox?<br><br>I'm currently using TextBox.SetFocus to place the cursor in a textbox and want to make sure the contents of the textbox are highlighted so the user can be easily copy or cut them to the clipboard.<br><br>Of course it would also be nice if I could get the VB program to do a copy or cut...<br><br>Thanks.
 
Use these properties of the text box to highlight the text<br><br>Text1.SelStart =1<br>Text1.SelLength=len(Text1.Text)(text1.text)<br><br>then use the VB ClipBoard object to &quot;Copy&quot; the highlighted text<br><br>Clipboard.SetText Text1.SelText<br><br>You can use the ClipBoard.GetText method to move the clipboard text around<br><br>Text2.Text = ClipBoard.GetText<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top