-3

I need to format my display tostring results to a currency in C#

display = "Service Amount: " + service + "<br>" +   
          "Discount Amount: " + discountAmount + "<br>" +
          "Total: " + total + "<br>";
        lblDisplay.Text = display;

I did try the following:

display = "Service Amount: " + Console.Write(int.ToString("c",service)) + "

but I couldn't figure out what variables to put in. I just need it to display as $35.00 after the it returns the string.

Reduls
  • 38
  • 1
  • 8

2 Answers2

0
String.Format("Service Amount: {0:C}<br>", service)
0

Try:

display = string.Format("Service Amount: {0}",service.ToString("C"));
Console.WriteLine(display);

You can also look at StringBuilder for building strings or String.Format

JKennedy
  • 18,150
  • 17
  • 114
  • 198