输入密码的问题If (Trim(Text1.Text) = "") Then
MsgBox "id不能为空"
End IfIf (Trim(Text2.Text) = "") Then
MsgBox "密码不能为空"
Else
If (Not IsNumeric(Trim(pas))) Then
MsgBox "密码不是数值型"
End If
End If
我想先判断id和密码是否为空,如果为空让用户再次输入,可是我这个程序顺序的执行,如果id为空给出了提示之后,点机确定不能停下来让用户再次输入。而是又提示密码不能为空。点击确定后,就接着向下走了。我想到用循环什么时候对了,什么是在向下走。可是他应该怎么停下来呢,就像c里的getchar()一样等待用户的输入
谢谢

解决方案 »

  1.   

    If (Trim(Text1.Text) = "") Then
        MsgBox "id不能为空"
        text1.setfocus
        exit sub
    End IfIf (Trim(Text2.Text) = "") Then
        MsgBox "密码不能为空"
        text2.setfocus
        exit sub
    Else
        If (Not IsNumeric(Trim(pas))) Then
            MsgBox "密码不是数值型"
            exit sub
        End If
    End If
      

  2.   

    If (Trim(Text1.Text) = "") Then
        MsgBox "id不能为空"
        text1.setfocus
        exit sub
    End IfIf (Trim(Text2.Text) = "") Then
        MsgBox "密码不能为空"
        text2.setfocus
        exit sub
    Else
        If (Not IsNumeric(Trim(pas))) Then
            MsgBox "密码不是数值型"
            exit sub
        End If
    End If