Disable RichTextBox Left Mouse Click

Posted on 2004-08-31
Last Modified: 2011-09-20

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

thanks -p
Question by:pipe
  • 3
  • 2
  • 2

Author Comment

ID: 11943803
i'd like to be able to highlight text but not have the ability to move the caret position.

Accepted Solution

somnatic earned 75 total points
ID: 11949310
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 ?
LVL 10

Expert Comment

ID: 11951272
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 11952977
"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?
LVL 10

Expert Comment

ID: 11960683
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 :-)

Expert Comment

ID: 11960692
who asked about the cursor ..
I thought it was all about the caret ..

Author Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question