Print Page | Close Window

Use enter on login

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=45
Printed Date: 20 December 2006 at 6:01pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Use enter on login
Posted By: Sync
Subject: Use enter on login
Date Posted: 07 February 2006 at 6:14pm
Originally posted by grimsk8ter11

Not to hard, Mis actually told me about this and i expanded on this a tad, and am now posting it for use with Build 1, (for reasons mis will knwo as soon as he get son MSN XD)


In frmLogin add these 2 subs

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


thiis is basicly what they ALL will do, the first box moves to the second box when enter is pressed the second box clicks the submit button.

frmNewAccount

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


frmDeleteAccount

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


frmCredits

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then Call picCancel_Click
    KeyAscii = 0
End Sub


finally the login fix

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


thsi jsut tells them the thing(s) they forget to put into the lgon form, much more professional like.

[edit]
1. Added daves fix




Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 6:14pm
Approved



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info