success success - 6 months ago 29 Question

Show extra decimal place as Double in

I tried to display the temperature. I set the temperature to be a double, when I get a temperature, e.g. 77 F, I really want to display 77.0 but I do not know how to do it? Thanks.

Wei Wei

Use the format specifier F

Dim Temperature As Double
Temperature = 77
Console.WriteLine(Temperature.ToString("F1", CultureInfo.InvariantCulture))

Will display 77.0

See Microsoft documentation