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.
 
Back
Top