我想做个登录框,选择用户,然后输入密码。
现在还需要点击一下“登录”按钮才可以进入主程序。怎么才能输入完密码之后,按回车就直接进入程序?

解决方案 »

  1.   

    设置"登录”按钮的default属性为true
      

  2.   

    '假设txtpassword为密码框,cmdlogin为登录按钮
    private txtpassword_keydown(KeyCode As Integer, Shift As Integer)
        if keycode=vbkeyreturn then call cmdlogin_click
    end sub
      

  3.   

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
        If KeyCode = 13 Then
            If Text1 = "Test" Then
                MsgBox "密码正确"
            Else
                MsgBox "密码不正确"
                Text1.SetFocus
                SendKeys "{Home}+{End}"
            End If
        End If
    End Sub
      

  4.   

    设置"登录”按钮的default属性为true 是最方便和兼容原有程序的.但如果你连那个"登陆"按钮都不想用,就用"虫虫"星哥的吧
      

  5.   

    设置"登录”按钮的default属性为true 是最方便的
      

  6.   

    登录”按钮的default属性为true