• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1001
  • Last Modified:

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
0
pipe
Asked:
pipe
  • 3
  • 2
  • 2
1 Solution
 
pipeAuthor Commented:
i'd like to be able to highlight text but not have the ability to move the caret position.
0
 
somnaticCommented:
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
 
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
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.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now