Results 1 to 6 of 6

Thread: [RESOLVED] help keypress "VbkeyReturn"

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    6

    Resolved [RESOLVED] help keypress "VbkeyReturn"

    im making a simple login form,
    i want to use the keypress,
    when i enter my username and password and hit the enterkey,
    the form2 will appear and also the msgbox if the username and password,is wrong.this what i have,but is not working,pls help what is worng or what should i do...tanx
    Code:
    Private Sub Command1_Click()
    If Text1.Text = "aaa" And Text2.Text = "111" Then
    Form2.Show
    Unload Me
    Else
    MsgBox "wrong"
    Text1.SetFocus
    Text1.Text = ""
    Text2.Text = ""
    End If
    Form1.KeyPreview = True
    End Sub
    
    Private Sub Command1_KeyPress(KeyAscii As Integer)
    Select Case KeyCode
    Case vbKey13
    Call Command1_Click
    End Select
    End Sub
    Last edited by RobDog888; Oct 6th, 2009 at 08:00 PM. Reason: Added [code] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width