Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String.Format("{0:C}" help

Status
Not open for further replies.

Dimitrie1

Programmer
Jan 5, 2007
138
CA
Code:
 x = lblNewBalance2.Text
 lblNewBalance2.Text = String.Format("{0:c}", x)

I am trying to display this value as $124.50. I get no errors yet it still displays 124.50

any ideas why
 
x = lblNewBalance2.Text
lblNewBalance2.Text = String.Format("{0:c}", CDbl(x))
 
should work
Code:
double x = Double.parse(lblNewBalance2.Text)
lblNewBalance2.Text = String.Format("{0:c}", x)

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
humm weird, worked for me..
This is exactly what I have
Code:
      Dim x As String
        lblNewBalance2.Text = "124.50"
        x = lblNewBalance2.Text
        lblNewBalance2.Text = String.Format("{0:c}", CDbl(x))
 
I know I have another field that works just fine.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top