|
-
January 21st, 2000, 12:31 PM
#1
Testing for Integer Input
Hello there!
I have developed a calculator program and now I want to check whether a user has entered an Intgere value(Without a decimal) so that the factorial of the value can be calculated.If the value contains decimal i-e it is not intger then an error can be raised.
I have tried the VarType function but to no avail
Please help,
Thnakx in advance
Kamra.
-
January 21st, 2000, 02:48 PM
#2
Re: Testing for Integer Input
Try something like:
Function IsDecimal(byval dVal as Double) as Boolean
IsDecimal = (Int(dVal) <> dVal)
End Function
Usage: If IsDecimal(dMyValue) Then Msgbox "Can't Calculate Factorial"
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|