decimal calculation

  • Thread starter Thread starter karim
  • Start date Start date
K

karim

Hello All,
my question is how to get a text box or a label to display decimal
#, like 0.9 or 1.4.
what i'm trying to do is to convert from, for example, steps to miles. if 1
mile = 2000 steps, then if i put anything less than 2000 it show as a zero
(0). so how do i get it to be .#(point something)?
Thanks for all your help.
 
karim said:
Hello All,
my question is how to get a text box or a label to display decimal
#, like 0.9 or 1.4.
what i'm trying to do is to convert from, for example, steps to miles. if 1
mile = 2000 steps, then if i put anything less than 2000 it show as a zero
(0). so how do i get it to be .#(point something)?
Thanks for all your help.

You need to use floating point variables to do the calculation. Example:

Dim miles As Double = Convert.ToDouble(steps) * 0.01
fieldMiles.Text = miles.ToString("#.0")
 
Back
Top