csindorf
asked on
selecting text
another one that has slipped by me please.
after an error is determined and I have setfocus back into the box I want to select all the text in that box so the user can renter it.
TIA
Craig
after an error is determined and I have setfocus back into the box I want to select all the text in that box so the user can renter it.
TIA
Craig
text.sellength = len(text)
Try this:
Private Sub Text1_GotFocus()
' Select all text
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Regards,
Grant.
Private Sub Text1_GotFocus()
' Select all text
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Regards,
Grant.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'textbox.SetFocus
textbox.selstart = 0
textbox.sellength = Len(textbox.text)
textbox.selstart = 0
textbox.sellength = Len(textbox.text)
Skip99
I do not see how your code is any different than the other comments. If the question has already been answered as a comment, the questioner can accept a comment as answer. Since your "answer" is not unique, you have the option to "withdraw" your proposed answer.
I do not see how your code is any different than the other comments. If the question has already been answered as a comment, the questioner can accept a comment as answer. Since your "answer" is not unique, you have the option to "withdraw" your proposed answer.
skip99 changed the proposed answer to a comment
Friends. Skip99 and Erick37. Both of u gave correct answers but correct me if i am wrong. The set focus should come last in the line of coding.Right?
Like This:
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.Setfocus
<Smiling> csindorf. To whom u r gonna award points. <Smile>
Like This:
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.Setfocus
<Smiling> csindorf. To whom u r gonna award points. <Smile>
csindorf stated that he already set focus back to the box, so all that was left was to select the string
text.sellength = len(text.text)
text.sellength = len(text.text)
And also the Start position,
i.e. Text1.SelStart = 0
i.e. Text1.SelStart = 0
ASKER
First one in won the candy bar. :-)