在 Visual Basic 中,我不断收到 String To double Error [英] In Visual Basic, I keep getting String To double Error
本文介绍了在 Visual Basic 中,我不断收到 String To double Error的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的咖啡店程序中添加长度检查...我已经整理了一些,但我看不出哪里出错了.
I am trying to add a length check in my coffee shop program... i have sorted some of it out but i cant see where I am going wrong.
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)
这段代码没有任何意义.
This code doesn't make any sense.
您正在检查 Name
(一个字符串)是否小于或等于 3(嗯?),然后获取结果的 Len()
查看.(嗯?)
You're checking whether Name
(a string) is less or equal to than 3 (huh?), then getting the Len()
of the result of that check. (huh?)
您可能想要获取字符串 (Len(Name)
) 的 Len()
,然后检查其结果(即数字)是否为小于或等于 3.
You probably want to get the Len()
of the string (Len(Name)
), then check whether the result of that (which is a number) is less than or equal to 3.
这篇关于在 Visual Basic 中,我不断收到 String To double Error的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文