Results 1 to 4 of 4

Thread: selected text highlight

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8

    Unhappy

    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

  2. #2
    Guest
    Use the SetFocus method.

    Code:
    Text1.SelStart = 5
    Text1.SelLength = 10
    Text1.SetFocus

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8
    Forget the question! just realised I needed to set the focus

    thanks

  4. #4
    Guest
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width