wen i press the enter key,i can login.But i face a problem which is there will repeat call the login function when i press enter key a fews times and there got error!
how can i make the enter key is disable after i success login?
thnaks

Private Sub button1_keydown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TabControl1.KeyDown
        If e.KeyCode = Keys.Enter Then
            Call Button1_Click(sender, Nothing)


        End If

Recommended Answers

All 4 Replies

just add another variable boolean and 'if' procedure to make filter, it was login or not yet, hope it will help :D

how to check login o x?
thanks

how to check login o x?
thanks

See if this helps.

Public Class Form1
    Private hasLoggedIn As Boolean = False

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.Enter Then
            If hasLoggedIn = False Then Button1_Click(sender, e)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If hasLoggedIn = False Then
            hasLoggedIn = True
            MsgBox("Button1_Click")
        End If
    End Sub

End Class

it works!
thanks very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.