Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Select all text in a TextBox

4 views
Skip to first unread message

José Manuel (Computer Xàbia)

unread,
Dec 30, 2004, 5:50:41 AM12/30/04
to

Hi,
I need to all text in a TextBox was selected when the user goes into it.
While Click event seems not work, what can I do?

Tanks!


Daniel Moth

unread,
Dec 30, 2004, 6:08:15 AM12/30/04
to
Try the GotFocus event

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


"José Manuel (Computer Xàbia)" <jmes...@computerxabia.com> wrote in
message news:eq%236o1l7...@TK2MSFTNGP09.phx.gbl...

José Manuel (Computer Xàbia)

unread,
Dec 30, 2004, 12:30:18 PM12/30/04
to
I tried with GotFocus event, but if I select text in this event, the last
click message unselect the text.
This is:
1.- User clicks TextBox
2.- GotFocus event executes, and select the text.
3.- System process the click message and unselect the text!

Any suggestions?


Daniel Moth

unread,
Dec 30, 2004, 1:07:29 PM12/30/04
to
Now I recall that issue.. from memory the following workaround should do
it:

Add a windows.forms.timer to your form with a very small interval (e.g.
15ms)
in the got focus event: tmr.Enabled = true
in the tick event: tmr.Enabled=false; tb.SelectAll


"José Manuel (Computer Xàbia)" <jmes...@computerxabia.com> wrote in

message news:eWqt8Up7...@TK2MSFTNGP12.phx.gbl...

José Manuel (Computer Xàbia)

unread,
Dec 30, 2004, 1:38:21 PM12/30/04
to
Ok, thanks a lot!


bluebytez

unread,
Mar 21, 2005, 6:35:19 AM3/21/05
to

worked for me too, THANKS !
0 new messages