1

I am using a propertygrid in C# to get double values form the user, these values are diameters of circles and the user will input the diameters for example "25", but I want after typing and mouse leave the displayed value becomes like this "25.00 cm" (without quotes), meaning to add .00 and "cm" but I can't implement this as I get an error for converting double to string. Any help will be appreciated.

cmoha
  • 73
  • 1
  • 2
  • 10

1 Answers1

3
double v = 10;
string s = v.ToString(); // "10"
string f = string.Format("{0:0.00} cm", v); // "10.00 cm"
Kyle W
  • 3,702
  • 20
  • 32