如何判断TEXT.TEXT是整数?

CriedSky 2003-08-21 10:11:30
如题,谢谢
...全文
45 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qingming81 2003-08-21
  • 打赏
  • 举报
回复

if isnumeric(text.text) and cint(text.text) = text.text then
msgbox "整型"
else
msgbox "非整型"
end if
liul17 2003-08-21
  • 打赏
  • 举报
回复
if int(text.text) = text.text then
msgbox "整型"
else
msgbox "非整型"

endif
饮水需思源 2003-08-21
  • 打赏
  • 举报
回复
if text1.text<>"" then
if not isnumeric(text1.text) then
msgbox "不是数值型数据!",48,"提示"
exit sub
else
if text1.text=int(text1.text) then
msgbox "是整数"
else
msgbox "不是整数"
end if
end if
end if
strongfisher 2003-08-21
  • 打赏
  • 举报
回复
Public Function sffunLimitNumber(ByVal IntVal As Integer) As Integer
''''-------------------1-------------------
''''目 的:只允许在文本框内输入数字、退格、删除及回车键
''''输 入:ByVal IntVal As Integer,任意的键值
''''被传递值:无
''''返 回 值:过滤后的键值
''''输 出:无
''''注 解:
''''用 法:在文本框的KeyPress事件中输入KeyAscii = sffunLimitNumber(KeyAscii)即可
''''修 订 版:
''''-------------------1-------------------


If (IntVal <> vbKeyDelete) _
And (IntVal <> vbKeyBack) _
And (IntVal <> 13) _
And (IntVal < 48 Or IntVal > 57) Then
IntVal = 0
End If
sffunLimitNumber = IntVal

End Function

1,451

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧