Jump to content

[VB.NET 2005] Enter activa botão


Recommended Posts

Posted

Boas!

Tenho aqui uma duvida em vb.net 2005 que provávelmente é muito simples mas não estou mesmo a ver  :wallbash:

Em vb 6 eu fazia no botão

Default = True

e quando carregava "Enter" era como se tivesse carregado no respectivo botão...

mas em vb.net não encontro a propriedade Default... nem algo parecido...

Se alguem me poder ajudar  🙂

cumps  🙂

Posted

Podes fazer uma coisa deste tipo:


Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

        If e.KeyCode = Keys.Enter Then

            Button1_Click(Nothing, Nothing)

        End If

End Sub

Provavelmente existe uma maneira mais fácil mas esta é a que eu uso  🙂

NOTA: Não sei se é necessário ou não mas costumo meter a propriedade KeyPreview da form em True

Revolt Website Antigo Nick: Pauzinhos

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.