private sub text1_change()
if isnumeric(text1.text) then
msgbox "是数字"
else
msgbox "不是数字"
end if
end sub
if isnumeric(text1.text) then
msgbox "是数字"
else
msgbox "不是数字"
end if
end sub
解决方案 »
- 有兴趣的朋友一起来研究:可以填空的文本输入框
- vba中如何动态添加内容进ComboBox
- 如何设置数据链接属性sql数据库
- 关于打包的问题请教:注册问题。
- 如何改变一个dll(如scrrun.dll)在使用regsvr32注册后在注册表中的项目名称?{0D43FE01-F093-11CF-8940-00A0C9054228}
- 如何用mscomm控件向仪表里发送数据?
- 在线求救!ADODC在开发的机器运行正常,打包安装在其他机器上就不正常,怎么办
- vb有控制串行或并行口的控件吗?
- 大家看这里的程序你能运行成功吗?http://www.daqchina.net/daqchina/acquire/winacq.zip
- 如何使用 WRITEFILE 函数将二进制数据写入文件?
- 小問題
- 没分的问题
If KeyAscii > 57 Or KeyAscii < 48 Or KeyAscii = 8 Then KeyAscii = 0
End Sub
MsgBox ("必须为数字哦")
Exit Sub
End If
for i=1 to len(text1.text)
if mid(text1.text,i,1)>ASC("9") or mid(text1.text,i,1)<ASC("0") then
msgbox "有字母:" & mid(text1.text,i,1)
flag=flase
end if
next i
if flag=true then
msgbox "只有数字。"
end if
isnumeric(text1.text)=true 是数字
否则是除数字以外的其它字符