0

我正在尝试在我的咖啡店程序中添加长度检查……我已经整理了一些,但我看不出哪里出错了。

Dim Name As String

MsgBox("Welcome. You Are On The 'Hot Mornings' Self-Ordering Service", vbInformation, "Welcome To Hot Mornings!")
        Name = InputBox("Please Enter Your Name", "Welcome To Hot Mornings!", ,     MsgBoxStyle.OkCancel)

If Len(Name <= 3) Then
        Do Until Len(Name > 3)
            MsgBox("Error!", vbExclamation, MsgBoxStyle.OkOnly)
            MsgBox("An Error Occureed Earlier. We Are Currently Trying To fix This     Issue.", vbInformation, "Error!")
            Name = InputBox("Please Enter Your Name.", , "Must Contain More Than 3     Characters", MsgBoxStyle.OkCancel)
        Loop
    End If
4

1 回答 1

3
Len(Name <= 3) 

这段代码没有任何意义。

您正在检查Name(一个字符串)是否小于或等于 3(嗯?),然后获取该Len()检查的结果。(嗯?)

您可能想要获取Len()字符串 ( Len(Name)) 的 ,然后检查该结果(它是一个数字)是否小于或等于 3。

于 2013-01-20T14:27:07.943 回答