How to change the blinking cursor from "|" to "_" in a textbox

Asked

Viewed 3,189 times

4

I’d like to know how to use the character _ to write, like when you press the key Insert in some text editors (Notepad++) and the text is written with the _ in front of the letters. More basically, same as DOS. I wanted to put this in a VB textbox.

  • 1

    If I got it right you want to change the blinking cursor? do not understand the donwvote

  • That is, replace the blinking bar with a blinking _ . Open the command prompt, that’s basically what I want to do..

1 answer

3


The signs | and the _ are not equal, you can not simply change them, would cause a confusion in the user who would be using the application.

The Sign | means to include and insert characters in front of the cursor.

The Sign _ means to insert characters, replacing the one in front of the cursor.

Officially unable to change this cursor using control properties TextBox, but, there are always those who can give you a helping hand. In this link, which redirects you to the Codeproject website, shows you how to Override the Caret textbox. Another useful thing, is to programmatically activate the Insert keyboard, which would show the cursor _ in Textbox, here is an example, considering TextBox1 your Textbox:

Public Sub TextBox1_Enter(ByVal sender As Object, e As EventArgs) Handles TextBox1.Enter
    System.Windows.Forms.SendKeys.Send("{INS}") ' Envia o sinal para ativar a tecla Insert
End Sub
Public Sub TextBox1_Leave(ByVal sender As Object, e As EventArgs) Handles TextBox1.Leave
    System.Windows.Forms.SendKeys.Send("{INS}") ' Envia novamente, para desativar o Insert
End Sub

Anyway, there are 1001 ways to do this. On Codeproject shows many examples of how to customize your Textbox.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.