Поделиться через


How to: Hold Fractions in a Variable (Visual Basic)

A variable holds numbers with fractions if you declare it to be of type Double. The Double Data Type (Visual Basic) can hold floating-point numbers from -1.79769313486231570E+308 through 1.79769313486231570E+308.

You can also use the Single Data Type (Visual Basic) or the Decimal Data Type (Visual Basic) to hold fractions. For more information, see Numeric Data Types (Visual Basic).

To hold fractions in a variable

  1. Declare the variable with a Dim Statement (Visual Basic).

  2. Follow the variable name with an As clause.

  3. Follow the As keyword with the Double keyword.

See Also

Reference

Data Type Summary (Visual Basic)

Concepts

Type Characters (Visual Basic)

Numeric Data Types (Visual Basic)

Other Resources

Elementary Data Types (Visual Basic)