没调试,自已调试去吧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
然后判断是否 text1=text2
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