7,759
社区成员
发帖
与我相关
我的任务
分享
private function TextIsLong() as boolean
dim cur as currency
'Text1.text是文本框的值
if isnumeric(text1.text)=true then
if instr(1,text1.Text ,".",vbTextCompare )<>0 then
TextIsLong=false
else
if len(text1.text)>11 then
TextIsLong=false
else
cur = val(text1.text)
if cur<-2,147,483,648 or cur > 2,147,483,647 then
TextIsLong=false
else
TextIsLong=True
end if
end if
end if
else
TextIsLong=false
end if
end function
On Error Goto ErrProc:
Dim n As Long
n = CLng(Text1.Text)
MsgBox "Success"
Exit Sub
ErrProc:
MsgBox "Failed"