I have a combo box and I want to highlight all its text text upon Click or Enter events. Doing so for GotFocus event is easy
and I have already successfully tested.
But if I apply the above code to either Click or Enter events,
text is not highlighted, instead the cursor blinks at the position I clicked.
After some debugging I saw that text is highlighted indeed just after the execution of "text1.SelLength" command but right afterward is dehighlighted
To show you what I mean let assume the code below
(parenthesis is just line numbers)
I saw that text is highlighted indeed after the execution of line (2)
but after executing line (3) text is dehighlighted and cursor starts blinking as I wrote above.
Is this a bug or am I doing something wrong?
Code:
Sub Text1_GotFocus ()
text1.SelStart = 0 ' Start selection at beginning.
text1.SelLength = Len(text1.Text) ' Length of text in Text1.
End Sub
But if I apply the above code to either Click or Enter events,
text is not highlighted, instead the cursor blinks at the position I clicked.
After some debugging I saw that text is highlighted indeed just after the execution of "text1.SelLength" command but right afterward is dehighlighted
To show you what I mean let assume the code below
Code:
Sub Text1_GotFocus ()
(1) text1.SelStart = 0
(2) text1.SelLength = Len(text1.Text)
(3) msgbox "ok"
End Sub
I saw that text is highlighted indeed after the execution of line (2)
but after executing line (3) text is dehighlighted and cursor starts blinking as I wrote above.
Is this a bug or am I doing something wrong?