vbscript InputBox 确保非空值
vbscript InputBox ensure Non empty value
如何确保在InputBox中输入非空字符串值。在输入此值之前,控件不应转到下一条语句。
fileName=InputBox("Enter File Name", "File Name")
InputBox
returns 按下 "OK" 时用户输入的字符串,按下 "Cancel" 时的 "empty" 值。
有必要为用户提供取消程序的选项,因此您需要检查一下。
Do
fileName = InputBox("Enter File Name", "File Name")
If IsEmpty(fileName) Then
WScript.Quit ' Cancel has been pressed!
End If
fileName = Trim(fileName)
Loop Until fileName > ""
MsgBox "You entered " & filename
如何确保在InputBox中输入非空字符串值。在输入此值之前,控件不应转到下一条语句。
fileName=InputBox("Enter File Name", "File Name")
InputBox
returns 按下 "OK" 时用户输入的字符串,按下 "Cancel" 时的 "empty" 值。
有必要为用户提供取消程序的选项,因此您需要检查一下。
Do
fileName = InputBox("Enter File Name", "File Name")
If IsEmpty(fileName) Then
WScript.Quit ' Cancel has been pressed!
End If
fileName = Trim(fileName)
Loop Until fileName > ""
MsgBox "You entered " & filename