Results 1 to 5 of 5

Thread: Keeping focus

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I have a ricktext box, and a combobox. The combobox is for changing the color of selected text within the richtextbox.
    The problem is, I select the text I want to change the color of, but when I drop down the combobox, the Richtextbox loses focus and the text is deselected, is there a way to prevent this??

  2. #2
    Guest
    Private Sub combo1_Click()
    RichTextBox1.SetFocus
    End Sub

    Private Sub combo1_Change()
    RichTextBox1.SetFocus
    End Sub

    When you select the color, the RichTextBox will have the focus once again.

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    ok, but...

    Does the selected text become unselected? if so, that whole process is pointless

  4. #4
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    Add this code to your form code to keep the text selected:

    Code:
    Private Sub RichTextBox1_GotFocus()
    RichTextBox1.HideSelection = False
    End Sub

    [Edited by dsy5 on 09-30-2000 at 07:12 PM]
    Donald Sy - VB (ab)user

  5. #5
    Hyperactive Member dsy5's Avatar
    Join Date
    Jul 2000
    Location
    Lockport, NY
    Posts
    362
    Sorry, code in the above post will not keep the text selected when you replace it. I'll keep trying to find a solution.
    Donald Sy - VB (ab)user

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