Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
CInt Function
This standard VB function converts an expression to the data type integer by rounding.
Syntax
CInt(expression)
Returns
The value of expression as an integer.
Usage
After rounding, the resulting number must be within the range of -32767 to 32767, or an error occurs.
Strings that cannot be converted to an integer result in a Type Mismatch error. Variants containing null result in an Illegal Use of Null error.
Example
This example calculates the average of ten golf scores.
Sub Button_Click
Dim score As Integer
Dim x, sum
Dim msgtext
Let sum = 0
For x = 1 to 10
score = 7-
sum = sum + score
Next x
msgtext = "Your average is: " & _
Format(CInt(sum/ (x - 1)), "General Number")
End SubSee Also
CCur Function
CDbl Function
CLng Function
CSng Function
CStr Function
CVar Function
CVDate Function
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |