先在一个文本框中进行密码设置,至少输入6位以上密码,按回车键后出现第二个文本框 重新输入一遍密码,按回车键后判断两次密码是否一致 用vb编程

解决方案 »

  1.   

    窗口中,放入text1,text2 然后设置密码属性
    然后判断是否 text1=text2
      

  2.   

    没调试,自已调试去吧private i as integer '全局变量Private Sub Text1_KeyPress(KeyAscii As Integer) 
     If KeyAscii = 13 Then 
     If i=0 then
        If len(text1.text)<6 Then 
          msgbox "密码不得少于6位"
        Else
          text2.enabled=true
          text2.visible=true
          i=1
        End If
    Else
        If len(text2.text)<6 Then 
          msgbox "密码不得少于6位"
        Else
          If text1.text=text2.text Then
             msgbox "登陆成功"
             text1.text=""
             text2.text=""
             text2.enabled=flase
             text2.visible=flase
              i=0
          Else
             msgbox "密码不一致,重新输入"
             text2.text=""
          End If
        End If
    End If end if
    End Sub