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.
Asked
Active
Viewed 711 times
1
-
1[Standard Numeric Format Strings](https://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx) – Ňɏssa Pøngjǣrdenlarp Jul 22 '16 at 17:01
-
2Possible duplicate of [Formatting a double to two decimal places](http://stackoverflow.com/questions/18418668/formatting-a-double-to-two-decimal-places) – Visual Vincent Jul 22 '16 at 17:04
2 Answers
0
Dim value As Double
value = 70
Console.Writeline(value.ToString("0.0", CultureInfo.InvariantCulture))
displays: 70.0
Make sure you search for an answer before posting a question (e.g. "vb.net number format"). I'm surprised the site did not offer you related questions/ answers when you were typing up the question.

RIanGillis
- 619
- 1
- 6
- 15
0
Use the format specifier F
Dim Temperature As Double
Temperature = 77
Console.WriteLine(Temperature.ToString("F1", CultureInfo.InvariantCulture))
Will display 77.0

Wei
- 724
- 9
- 10