|
-
Mar 11th, 2011, 05:16 AM
#1
Thread Starter
Hyperactive Member
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.
-
Mar 11th, 2011, 05:35 AM
#2
Junior Member
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.
-
Mar 11th, 2011, 05:37 AM
#3
Thread Starter
Hyperactive Member
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
-
Mar 11th, 2011, 05:40 AM
#4
Junior Member
Re: VB6 - Select All Text In Textbox
-
Mar 11th, 2011, 09:40 AM
#5
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
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|