This is supposed to take text data from one textbox, do some math on it, output the result to another textbox and pad the value with a trailing 0 in the event it’s a round number. It calculates the value correctly and if the result has a remainder, it properly formats it with one decimal place (123.789 formats as 123.8), but if it’s an integer result, it doesn’t work (123.00 formats as 123, not 123.0). What am I doing wrong here? My understanding of the String.Format() method from here and other resources suggests this should work the way I want, but it ain’t. This is .NET C# under Visual Studio 2005.
Hm, looking at your code, I’m not sure what the second line is meant to be accomplishing? Why are you converting to a string, just to then format your temporary string as a number?
^ Appears to be the preferred method. Certainly it means that you won’t be losing your double’s type when you go to format. But I admit to not knowing C#.
Then yeah, your problem was that you were trying to format a non-numeric (a string) as a numeric. In making it’s best guess at how to do that, it probably got confused and forgot to do some of the formatting.