Jump to content
jcbiker

Como colocar o corsor de uma caixa de texto no fim

Recommended Posts

jcbiker

Boas tenho este código,

If Len(txtMatS) = 2 Then
                e.Handled = True
                txtMat.Text = txtMatS + "-" + e.KeyChar + selLength(txtMatS + 1)

            End If

pretendo que no final o cursor esteja no fim.

Alguem me pode ajudar??

Share this post


Link to post
Share on other sites
ribeiro55

Não sei em que âmbito estás a correr as linhas, presumo que num keypress ou semelhante, mas de qualquer maneira podes resolver com

        TextBox1.SelectionStart = TextBox1.Text.Length
        TextBox1.Focus()

Menos o focus se estiveres num keypress, pois o foco não sai da caixa.


Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.