问个VB的问题啊

来源:百度知道 编辑:UC知道 时间:2024/05/03 03:35:03
End Sub

Private Sub Timer1_Timer()
Label2.Caption = Time
intRemainder = intRemainder - 1 这个-1是什么意思呀?
intMinute = intRemainder \ 60
intSecond = intRemainder Mod 60
If Len(intSecond) = 1 Then
Label4 = intMinute & ":" & "0" & intSecond
Else
Label4 = intMinute & ":" & intSecond
End If
If intRemainder = 0 Then
Label5.Visible = True
Label3.Visible = False
Label4.Visible = False
Timer1.Enabled = False
End If
End Sub

Option Explicit
Private Sub Form_Load()
Const password = "pass"
Dim intcounter As Integer
Dim strpassword As String
For intcounter = 1 To 3
strpassword = InputBox("请输入您的密码:", "输入密码")
If strpassword = password Then Exit For
Next intcounter
If intcounter > 3 Then
MsgBox "对不起!您是非法用户", vbOKOnly + vbCritical, "拒绝"
Unload Me
End If
Unloa

还有上文呐。。全部贴下吧。估计intRemainder是一个计数器吧
倒计时用的

intcounter什么时候被定义成输入密码次数:
…………………………
Const password = "pass"
Dim intcounter As Integer <<<<这里就是啊 所有数值变量默认值是0
…………………………

还有
For intcounter = 1 To 3 就是循环 也就是For与Next之间的内容执行 3-1+1=3次,并且每次循环结束 intcounter自动+1
而如果用户密码输入正确则直接退出循环

但是貌似永远都不会是非法用户 因为循环以后intcounter最大值是3(1 to 3)
而判断非法用户是判断>3就是不包含3的 所以貌似有问题

………………………………………………
If intcounter > 3 Then <<<<这句应该是If intcounter >= 3 Then
MsgBox "对不起…………………………