AutoSelect textbox

January 4, 2006

Did some googling for this problem and didn’t find an answer, then figured it out on my own – so sharing some info for other developers.

Problem: Want a text box to “autoselect” the entire text when a user clicks on it. Just doing a textBox1.SelectAll() in the Enter event doesn’t do it, I think becuase the click event clears the selection when your placing the cursor in it.

My solution was to pu the textBox1.SelectAll() call in the MouseUp event.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: