tags:

views:

89

answers:

1

Hi Is there any way to disable cursor in textbox without setting property Enable to false? I was trying to use ReadOnly property but despite the fact that I can't write in textbox, the cursor appears if I click the textbox. So is there any way to get rid of this cursor permamently ?

+4  A: 

You could use a Label instead. When in the designer, you set BorderStyle = Fixed3D, BackColor = Window and AutoSize = False, it looks a lot like a TextBox.

However, the cursor in a TextBox is provided so that the user can scroll through the text when it is longer than the box. You'll lose that functionality with a Label, unless you are sure that it will always fit. Other than that, it is not possible to remove the cursor from a TextBox.

Virtlink
A ReadOnly textbox is also useful for displaying information that the user might want to copy and paste somewhere else. By using a Label (or otherwise disabling the cursor) that ability is lost or reduced. But if you truly want to display information without the ability to select it, then a Label is the right tool for the job.
Jeffrey L Whitledge