Results 1 to 2 of 2

Thread: selection

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I have a richtextbox. In my Richtext_Change() code I have this:
    Richtext.SelStart = 0
    So that the text is inputted backwards. My problem is this,
    When I try to select text to make bold, it works, but the cursor is then sent back to 0, instead of the selected text remaining selected. I tried this in my Richtext_selChange() code:
    Dim sLength as integer
    Dim sStart as integer

    sLength = Richtext.Sellength
    sStart = Richtext.SelStart

    and then this code at the top of the Richtext_change() module:

    if (Richtext.selLength = 0) then
    Richtext.SelStart = 0 'the code at the top
    Else
    Richtext.selStart = sStart
    Richtext.selLength = sLength
    End If

    but is doesn't work, any ideas to keep the text selected?

  2. #2
    Guest
    Well, assuming you have a control to change it into bold, add this to the end of it:

    Code:
    .
    .
    .
    formatchg = True
    .
    .
    .
    and add this to Richtext_Change():

    Code:
    .
    .
    .
    If formatchg = True then 
        formatchg = False
        End Sub
    End If
    .
    .
    .
    and dont forget this at the beginning:

    Code:
    ...
    Public formatchg As Boolean
    .
    .
    .
    Hope it helps.

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