Is there any eventhandler for RichTextBox in vb.net to catch the selection of text event?
I want to enable cut,copy,delete control mentu strip items on selecting text.

Edit > cut,copy,paste,delete

Only on selecting text the cut,copy,delete should be enabled

Please help me out....

Recommended Answers

All 3 Replies

I don't think there is an event for a rich text box, or if there is, I do not know about it, but what you could do is use a normal Textbox, with the option of 'multi line', and I am sure it will be easier to selecting an event.
Hope this helps :)
x

Try using the RichTextBox_SelectionChanged Event.
Inside of the event handler test the SelectionLength property of the RichTextBox like this:

    If RichTextBox.SelectionLength > 0 Then
            MenuStripItems.Visible
    else

    End If

Sorry, my first one was incomplete.

Try using the RichTextBox_SelectionChanged Event.
Inside of the event handler test the SelectionLength property of the RichTextBox like this:

If RichTextBox.SelectionLength > 0 Then
            MenuStripItems.Visible = True
        else
             MenuStripItems.Visible = False
        End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.