-
I have a multiline textbox. Selecting text in it with mouse causes the selected text to go blue, but selecting it with code like this
Text10.SelStart = under
Text10.SelLength = over - under
Clipboard.Clear
Clipboard.SetText Text10.SelText
while it goes to clipboard fine, doesn't make it go blue. I'd like it to go blue when selected in code. Any thoughts?
Thanks
-
Use the SetFocus method.
Code:
Text1.SelStart = 5
Text1.SelLength = 10
Text1.SetFocus
-
Forget the question! just realised I needed to set the focus
thanks
-
SetFocus is better, but I didn't write this code for nothing ;].
Code:
Private Sub Text1_GotFocus()
Dim T As Long
T = Len(Text1.Text)
Text1.SelStart = 0
Text1.SelLength = T
End Sub