Returns an expression that has been converted toSingleSubtypeVariant。
expressionArgument is any valid expression.
In general, you can write code using subtype conversion functions to show that the results of some operations should be represented as a specific data type rather than the default type. For example, in the case of currency or integer operations, useCDblorCSngForces double or single precision operations.
CSngThe function is used to transfer data from other data types toSingleSubtypes are converted to internationally recognized formats. For example, the recognition of decimal separators, such as the thousand separator, depends on the locale of the system.
IfexpressionAn error occurs if it is outside the range allowed by the single subtype.
The following example usesCSngFunction converts a value toSingle:
Dim mydouble1, mydouble2, mysingle1, mysingle2 'mydouble1, mydouble2 are double precision values. Mydouble1 = 75.3421115: mydouble2 = 75.3421555mysingle1 = CSng (mydouble1) 'mysingle1 contains 75.34211. Mysingle2 = CSng (mydouble2) 'mysingle2 contains 75.34216.