我正在尝试在我的咖啡店程序中添加长度检查…我已经整理了一些,但我不知道我错在哪里。
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
Len(Name <= 3)
这段代码没有任何意义
您正在检查Name
(字符串)是否小于或等于3(嗯?),然后获得该检查结果的Len()
。(嗯?)
您可能想要获得字符串(Len(Name)
)的Len()
,然后检查其结果(这是一个数字)是否小于或等于3。