Disable RichTextBox Left Mouse Click


how can i disable the left mouse click for a richtextbox so a user cannot move the caret?

thanks -p
Who is Participating?
somnaticConnect With a Mentor Commented:
how about used "hidecaret" to hide the caret from the user

To Highlight the Text, you should be able to use the Select Method that comes with RichTextBox programmatically ..

would that be an option ? Or does the user has to be able to select text ?
pipeAuthor Commented:
i'd like to be able to highlight text but not have the ability to move the caret position.
I don't think u can disable the cursor from appearing the textbox.

What u can do is
Deviate the focus to some other textbox or any other control ex.

 Private Sub TextBox1_MouseDown(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles TextBox1.MouseDown

        If e.Button = MouseButtons.Left Then
        End If
    End Sub

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

pipeAuthor Commented:
"how about used "hidecaret" to hide the caret from the user"

hiding the caret would work i think. however, i checked msdn and i didnt see any method for doing this with a richtextbox. do you know how i would go about doing this?
I tried the cursor.hide method. But that works well for a button control. But it does not work for a textbox. So I think my previous reply holds good :-)
who asked about the cursor ..
I thought it was all about the caret ..
pipeAuthor Commented:
i did a dll import of the hidecaret method. i got it working. i think i call it on mouseenter or over. thx
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.