-
Text Box Property?
I have a series of small text boxes that I'm using to enter numerical data on a form. I want to be able to change the data quickly as I tab through them, so I'm looking for a way to have the text automatically highlight when it's text box recieves the focus. How can I do this?
Thank you for all your help.
The more you know, the more you know you don't know.
-
Re: Text Box Property?
Private Sub txtYourTextBox_GotFocus()
txtYourTextBox.SelStart = 0
txtYourTextBox.SelLength = Len(txtYourTextBox.Text)
End Sub
Regards,
Michi
MCSE, MCDBA
-
Re: Text Box Property?
Ummm... That sort of worked. It highlighted the contents of the text boxes alright, but it won't let me enter more than one integer now, because the content is continually highlighted. Is that because I'm using the GotFocus event? hmmm... any ideas?
The more you know, the more you know you don't know.
-
Re: Text Box Property?
Nevermind. I made a stupid mistake. I had it set to the Change event instead of GotFocus. That code works just fine. Thank you.
The more you know, the more you know you don't know.
-
Re: Text Box Property?
It works fine for me. I guess maybe the MaxLength property of this TextBox is set to 1. If so, try to change it to 0 or whatever you want.
Regards,
Michi
MCSE, MCDBA