TechArena Community How to display only part of a decimal number

#1
30-01-2009
 Member Join Date: Aug 2008 Posts: 145
How to display only part of a decimal number

Hi,
If there is a decimal number & i want to display only the complete part ie. left part of the point then how can i do the same?
Vb.net platform
Let me explain this.

In maths 25.49 = 25 and 25.51 = 26
But i don't want this way to get the result
I want to display only the number 25 no matter what comes after decimal point.
#2
31-01-2009
 Member Join Date: May 2008 Posts: 115
Re: How to display only part of a decimal number

this is the way you can get the desired result!

number = cint(int(12.51))

Thanks!
#3
31-01-2009
 Member Join Date: May 2008 Posts: 40
Re: How to display only part of a decimal number

First you have to convert from String to a number, then cut the
decimal places, then convert to Integer. Conversion from String to
number is culture dependent (usually "." or "," as decimal separator).

Dim number As Integer

number = cint(math.floor(cdec(TextBox1.Text)))
msgbox (number)

 Tags: