VB,设计一个程序利用文本框检查用户口令,并用静态变量来限制输入口令的次数

2025-03-24 00:16:27
推荐回答(2个)
回答1:

Private Sub Command1_Click() '登录按钮
Static cs As IntegerIf Text1.Text <> 123456 Then
cs = cs + 1
If cs >= 3 Then End
Else
'写入登录成功后想运行的语句
End If
End Sub

回答2:

dim i as integeri=0if text1.text<>"123456" then i=i+1if i>3 then endend ifelsemsgbox"登录成功"end if