求VB中,在数据的合法性检验中,限制输入一个合法的三位正整数,否则弹出非法提示框的代码

需调用Text_KeyPress,MsgBox,IsNumeric函数
2025-03-05 04:32:11
推荐回答(1个)
回答1:

if keycode=13 then
if isnumeric(text1.text)=true then

if val(text1.text)<100 or val(text1.text)>999 then

msgbox "你输入的整数不合法 100-999"

exit sub

else

msgbox "输入合法"

end if

end if