c# – Format double with thousand and decimal

Question:

I have the following value:

43239.110000000001

I used this command:

txtSomatorio.Text = String.Format( "{0:#.#,##}", somatorio);

I got this:

43239,11

How to display like this?

43.239,11

Answer:

Try using it this way:

string.Format("{0:0,0.00}", somatorio); // saída = 43.239,11

Or like this:

string.Format("{0:N}", 43239,11)); // saída = 43.239,11
Scroll to Top