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

4

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

    
asked by anonymous 03.10.2015 / 02:01

1 answer

3

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

  

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

     

Sign _ means to insert characters, replacing whatever is in front of the cursor.

Officially it is not possible to change this cursor using properties of the TextBox control, but there are always those that can lend you a hand. In that link , which redirects you to the CodeProject website, shows how to do the Caret Override of the TextBox. Another useful thing is to programmatically activate the Insert mode of the keyboard, which would display the _ cursor in the TextBox, there is an example, considering% its_ its TextBox: p>

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. At CodeProject site shows many examples of how to customize your TextBox.

    
12.10.2015 / 00:14