Jump to content

Tecla Enter acionando CmdAvançar


Recommended Posts

Senhores preciso de ajuda para acionar o botão  " CmdLogin "  através do acionamento da tecla ENTER ..

Private Sub CmdLogin_Click()

If TextUsuario.Text = "SILVERIO" And TextSenha.Text = "TBG" Or TextUsuario.Text = "GERALDO" And TextSenha.Text = "TBG" Or TextUsuario.Text = "DIEGO" And TextSenha.Text = "TBG" Or TextUsuario.Text = "FLAVIO" And TextSenha.Text = "TBG" Then

Unload Me

frmConector.Show 1

Else: MsgBox " *** Login e ou Senha  incorreto tente novamente *** ", vbOKOnly, "CVTEST"

TextUsuario.Text = ""
TextSenha.Text = ""

End If

End Sub


 

Link to post
Share on other sites
San Roman

Boa tarde DDTRON

Tenta o seguinte:

Private Sub frmCategoria_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown

If e.KeyCode = Keys.Enter Then
  cmdLogin.PerformClick()
End If

End Sub

Em propriedades de seu form deixe KeyPreview = True.

E em seu Form Eventos coloque o código acima em KeyDown.

Espero ter ajudado.

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.