Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How VB Converts Integer Data Type to Single Floating Point Data Type
How VB Converts Integer Data Type to Single Floating Point Data Type
VB can use CSng function to convert integer data type into single-precision floating-point data type.

CSng function example

This example uses the CSng function to convert an integer value to a single value.

Private? Sub? Command 1_Click()

Dim? MyInteger? As? integer

Dim? My single? As? single

MyInteger? =? 7534

My single? =? CSng (my integer)

Debugging. Print? My singleness

Debugging. Print? LenB(MyInteger)

Debugging. Print? Rambo (My Single)

End? The output of the child debugger. Print LenB(MyInteger) is 2, which is the number of bytes of integer data type.

Debugging output. Print LenB(MySingle) is 4, which is the number of bytes of a single data type.