Results 1 to 2 of 2

Thread: Problem with selected text - RichTextBox

  1. #1
    Stiletto
    Guest

    Problem with selected text - RichTextBox

    y0,
    In my app the user can cut, copy and paste text.
    I want the Cut button to be enabled only when the user is selecting a text (with Shift), and if the user is not selecting anything i want the button to be disabled.
    I've tried this:
    VB Code:
    1. Private Sub EditText_Change()
    2. If Len(EditText.SelText) > 0 Then
    3.     Toolbar1.Buttons(11).Enabled = True
    4.     Toolbar1.Buttons(12).Enabled = True
    5. Else
    6.     Toolbar1.Buttons(11).Enabled = False
    7.     Toolbar1.Buttons(12).Enabled = False
    8. End If
    9. End Sub
    How can i do that?

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Try the SelLength property instead
    VB Code:
    1. If RichTextBox1.SelLength > 0 Then
    2.     MsgBox RichTextBox1.SelText
    3. Else
    4.     MsgBox "No text selected!"
    5. End If

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