How do I round off to nearest 10000


#1

I am capturing 15,410,690… I want to convert this into number (Used val.gettypecode.ToString ?) and round it off to nearest 10,000 to get 15,410 ?


#2

shoudn’t your answer be 15,410,000 ?

Rounding : Math.Round(number / 10000)*10000

Do you have a decimal after 140?

Floor : Math.Floor(15410.690)


#3

I am getting error . variable1 is a number variable


#4

DataType should be either double or decimal, in your case Double.

@sampaddas Info in message box should always be string, so add ToString


#5

Will the Math function work on String ?

How do I convert to double. variable1.ToDouble ?If not, how do i convert ?

Please explain with a example


#6

Hope attached xaml helps. You might run into run time errors if your string is not in proper format (commas etc). Try to remove them before you convert to Int,double etc.

Math.xaml (7.1 KB)


#7

It worked , Thanks !!