我正在开发一个项目,让孩子们向圣诞老人发送消息。不幸的是,如果他们在年龄字段中输入字符串而不是整数,程序就会崩溃并返回“从字符串“[exampleString]”转换为类型'Double'无效”的错误信息。 有没有办法检查他们是否输入了整数?以下是代码。
If childAge > 0 And childAge < 150 Then
fmSecA2 = "Wow! You are already " & childAge & " years old? You're growing to be a big " & childGender & " now! "
Else
fmSecA2 = "Erm, I couldn't really understand your age. Are you making this up? Ho ho ho!"
End If
感谢您,Kai :)