-->>SOmething is Confusing Me or Doesn't provide Me with actual Results I needed...
-->>I want to Calculate some Numbers and Its result if It has more than 3 decimal places...
-->>I want it to be rounded only to 2 decimal palces...
-->>What I dont want is that when I use Vb6 Inbuilt Functions for this it does some aproxmations...
-->>For Example if the Number is 0.3195 it gives me 0.32,this is bad for Me...
-->>I only need the 2 decimal places without approximating the Third digit...
-->>That is the Number 0.3195 to be 0.31!!!
-->>Thanks...

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by AndreRet

Try this,

Dim test2 As Double = 0.3195
Dim test As Double = Fix(test2 * 10 ^ 2) / 10 ^ 2

this will produce .31 as the value of test. If you want more decimal places change the 2 in 10 ^ 2 to the number of decimal places you want.

You can use the format function -

Text1.Text = Format("0.3195", "#00.00")

You can also try -

Left(cStr("0.3195"), instr(cStr("0.3195"), ".") + 2))

-->>No doupt it is Solve...
-->>Thanks for Your HELP tinstaafl and AndreRet

Only a pleasure. Happy coding...