Link to home
Start Free TrialLog in
Avatar of pipe
pipe

asked on

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
Avatar of pipe
pipe

ASKER

i'd like to be able to highlight text but not have the ability to move the caret position.
ASKER CERTIFIED SOLUTION
Avatar of somnatic
somnatic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of pipe

ASKER

"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
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 ..
Avatar of pipe

ASKER

i did a dll import of the hidecaret method. i got it working. i think i call it on mouseenter or over. thx