TextBox.SelectAll() not working

  • Thread starter Thread starter PR
  • Start date Start date
P

PR

Hello,

I have a bunch of textboxes on my form, and I would very much like it if
their text could be automatically selected when each one is entered.

I've tried code like this:

Private Sub TextBox3_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox3.Enter
TextBox3.SelectAll()
End Sub

This works if the entry is due to the tab key being pressed, but it doesn't
work if the box is entered using the mouse. Does anyone have any ideas why
this might be?

Thanks for the help.
 
I have a bunch of textboxes on my form, and I would very much like it if
their text could be automatically selected when each one is entered.

I would also like to know if I can get something like this to happen for
every text box on the form without having to either create a custom object
(overkill) or write the same code in 15 different events (awful). Something
that would apply to the Enter event of every instance of
Sytem.Windows.Forms.Textbox on form Document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Textbox focus on tabpage? 1
MDI size and MDIClient Size after Layout event is not the same 2
parsing 1
SetFocus Not working 4
Debugging Error 1
Textbox forecolor when disabled 3
exit command 1
Handler question 3

Back
Top