Disable RichTextBox Left Mouse Click

hi-

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

thanks -p
pipeAsked:
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 ?
 
0
 
pipeAuthor Commented:
i'd like to be able to highlight text but not have the ability to move the caret position.
0
 
123654789987Commented:
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
            textbox2.Select()
        End If
    End Sub

0
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?
thx
0
 
123654789987Commented:
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 :-)
0
 
somnaticCommented:
who asked about the cursor ..
I thought it was all about the caret ..
0
 
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
0
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.