Showing posts with label Convert int to dec. Show all posts
Showing posts with label Convert int to dec. Show all posts

Tuesday, January 25, 2011

Convert an integer into a decimal and a decimal into an integer in Visual Basic

To convert an integer (NoFrogs) into a decimal you would use the CDbl command.

1:  Dim NoFrogs as integer
2: Dim TotalFrogs as Double
3: TotalFrogs = CDbl(NoFrogs)

To convert a decimal (NoFrogs) into an integer you would use the CInt command.

1:  Dim NoFrogs as decimal
2: Dim TotalFrogs as Integer
3: TotalFrogs = CInt(NoFrogs)