Difference between revisions of "Is it an integer"

From HashVB
Jump to: navigation, search
m (Added VB6 header)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
{{VB6}}
 
So, you want to tell if a number is an integer?
 
So, you want to tell if a number is an integer?
  

Latest revision as of 14:03, 9 November 2005

float
 This article is based on Visual Basic 6. Find other Visual Basic 6 articles.

So, you want to tell if a number is an integer?

VB has a very useful function called Int() that will give you the integer portion of a number. You can then compare this to the original, and if they match, it is an integer.

Function IsInteger(byval Value) as Boolean
  IsInteger = (Int(Value) = Value)
End Function

Simple as that.