Set cursor to the end

Jelmer

Regular
Joined
Jan 11, 2006
Messages
96
hello

I have a little code to change a '.' into a ','.
But after the changing the cursor is put to the beginning of the textfield.

Before:

45.|
after translation:
|45,

The | is the cursor.

My code: txtPrijs.Text = txtPrijs.Text.Replace(".", ",");

I like to put the cursor tot the end of the line..
But how?
 
Assume there's a form with a textbox and a button. In the button's click event, put the following code...

Visual Basic:
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Me.TextBox2.Focus()
        Me.TextBox2.Text = "superfly crazy!!"
        Me.TextBox2.Select(Me.TextBox2.Text.Length, Me.TextBox2.Text.Length)  '' <------- The important line for you.
    End Sub
 
Back
Top