Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Enter to Login (and more)
#1
Author: grimsk8ter11
Difficulty: 1/5

:: CLIENT SIDE ::
In frmLogin, add:
Code:
Private Sub txtName_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtPassword.SetFocus
        KeyAscii = 0
    End If
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
         Call picConnect_Click
         KeyAscii = 0
     End if
End Sub
In frmNewAccount, add:
Code:
Private Sub txtName_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtPassword.SetFocus
        KeyAscii = 0
    End If
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
         Call picConnect_Click
         KeyAscii = 0
     End if
End Sub

In frmDeleteAccount, add:
Code:
Private Sub txtName_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        txtPassword.SetFocus
        KeyAscii = 0
    End If
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
         Call picConnect_Click
         KeyAscii = 0
     End if
End Sub

In frmCredits, add:
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then Call picCancel_Click
    KeyAscii = 0
End Sub
Replace sub picConnect with this:
Code:
Private Sub picConnect_Click()
    If Trim(txtName.Text)  "" And Trim(txtPassword.Text)  "" Then
        Call MenuState(MENU_STATE_LOGIN)
    ElseIf Trim(txtName.Text) = "" And Trim(txtPassword.Text) = "" Then
        Call MsgBox("Please enter your login name and password!", vbOKOnly)
    ElseIf Trim(txtName.Text) = "" Then
        Call MsgBox("Please enter your login name!", vbOKOnly)
    ElseIf Trim(txtPassword.Text) = "" Then
        Call MsgBox("Please enter your password!", vbOKOnly)
    End If
End Sub
That's all!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)