Siebel VB Language Reference > Methods Reference for Siebel VB > Conversion Methods >

Convert Expression to Integer Method


The Convert Expression to Integer method converts the value that the expression argument contains to an integer and rounds the result. It returns this result. Note the following:

  • After rounding, the result must reside in the range of negative 32767 to 32767. If it is not, then an error occurs.
  • A string that cannot convert to an integer causes a Type Mismatch error.
  • A variant that contains a null result causes an Illegal Use of Null error.

For more information, see Numeric Data Types That Siebel VB Uses.

Format

CInt(expression)

For information about the arguments that you can use with this method, see Argument That You Can Use with Conversion Methods.

Example

The following 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 Sub

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.