private sub text1_lostfocus() if text1.text<>"" then if not isnumeric(text1.text) then msgbox "请输入数值型数据!",48,"提示" text1.setfocus else '取整,取绝对值 text1.text=abs(int(text1.text)) end if end if end sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) If Index = 1 Then If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8)) Then KeyAscii = 0 End If End If End Sub
if text1.text<>"" then
if not isnumeric(text1.text) then
msgbox "请输入数值型数据!",48,"提示"
text1.setfocus
else
'取整,取绝对值
text1.text=abs(int(text1.text))
end if
end if
end sub
If Index = 1 Then
If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8)) Then
KeyAscii = 0
End If
End If
End Sub