C
cj
I asked this question a couple of days ago but am just now looking at it
again.
I used to use the textbox gotfoucs event to have all the text in the
textbox selected when it gotfocus. That doesn't seem to work in .net
when the textbox receives focus via a mouse click.
Jeffrey and Shane both advised how to get a mouse click to select all
the text (thank you both) but using the mousedown or mouseup events
doesn't work the way I want it to. I want it to work like the address
bar in MS Explorer (just an example of a "text box" that works like I
want -- this has nothing to do with the internet). When the box
receives focus with a click everything in the box is selected. If you
then click in the box again everything is not selected and the cursor
goes to the place in the contents where you selected. Like I said I
used to do that by selecting all the text in the got focus event. It
worked well because on your second click the textbox is not receiving
focus as it already has focus.
What's the .net way to do this?
Why does selectall() not work in gotfocus?
again.
I used to use the textbox gotfoucs event to have all the text in the
textbox selected when it gotfocus. That doesn't seem to work in .net
when the textbox receives focus via a mouse click.
Jeffrey and Shane both advised how to get a mouse click to select all
the text (thank you both) but using the mousedown or mouseup events
doesn't work the way I want it to. I want it to work like the address
bar in MS Explorer (just an example of a "text box" that works like I
want -- this has nothing to do with the internet). When the box
receives focus with a click everything in the box is selected. If you
then click in the box again everything is not selected and the cursor
goes to the place in the contents where you selected. Like I said I
used to do that by selecting all the text in the got focus event. It
worked well because on your second click the textbox is not receiving
focus as it already has focus.
What's the .net way to do this?
Why does selectall() not work in gotfocus?