VB6 - Select All Text In Textbox
I have approximately 75 text boxes on my form.
Whenever one of these boxes get the focus I'd like it to select the whole field - basically so if there's a value already in there, you simply have to type over it rather than highlight the text in the box yourself.
Obviously I can do this by putting code in the gotfocus event, but I don't want to have to do this 75 times.
How can I get round this please?
Thanks.
Re: VB6 - Select All Text In Textbox
Could you make the textboxes into an array and have the clear textbox in the textbox_Click event? Just an idea.
Re: VB6 - Select All Text In Textbox
I'm not sure - If I can I don't really know how to do that.
However, what could complicate matters is the fact that 15 of the boxes relate to one thing, 15 relate to another etc
Re: VB6 - Select All Text In Textbox
Re: VB6 - Select All Text In Textbox
To select the contents:
Code:
Private Sub Text1_GotFocus()
With Text1
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub