jeudi 19 février 2015

Issue with Formatting a double variable to show in textbox in C#

Does anyone know why this Format command produces the following strange results:



textbox1.Text = String.Format("{0:+;-}{0,7:0.000;0.000}", dblVariable);


Here are the strange results (check the signs of the formatted text - the sign is incorrect for numbers smaller than 0.5):



dblVariable textbox1.Text
-0.100000 + 0.100
-0.200000 + 0.200
-0.300000 + 0.300
-0.400000 + 0.400
-0.500000 - 0.500


Thanks


Aucun commentaire:

Enregistrer un commentaire