Hi,
Could you please show me how to get
1.9
to show with two decimal places (1.90)


you can use

Math.Round(1.99999999, 2)

if you want to bring the decimal places down to two
but how do you increase from zero or one decimal place up to two?


Thanks
Peter

Hi,

Check this :

TextBox1.Text = Format(1.9, "0.00")
 
TextBox2.Text = Format(22, "0.00")

Regards
Veena

Thanks QVeen72,
It work perfectly.

I've only ever used Format with Dates beform and it never occured to used it with numerics


Thanks
Peter

Hi,
Could you please show me how to get
1.9
to show with two decimal places (1.90)


you can use

Math.Round(1.99999999, 2)

if you want to bring the decimal places down to two
but how do you increase from zero or one decimal place up to two?


Thanks
Peter

You can also use; assuming the variable is named dblResult...

CStr(dblResult.ToString("#,##0.00"))

It worked for me and it does round up/down as needed.

If you store your number in a variable of decimal type, you can convert into a string with two decimal places (including .00) this way:

Dim dAmount as Decimal
Dim strFormattedAmount as String

strFormattedAmount= dAmount.ToString("N2")


Hi,
Could you please show me how to get
1.9
to show with two decimal places (1.90)


you can use

Math.Round(1.99999999, 2)

if you want to bring the decimal places down to two
but how do you increase from zero or one decimal place up to two?


Thanks
Peter

commented: THANKS ITS WORK GREAT +1

Please do not resurrect old threads. If you want to ask question, start your own thread. Please read the rules before posting again - http://www.daniweb.com/forums/thread78223.html and rules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.