c# – Format double with thousands 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 can I display it like this?

43.239,11

Answer:

Try using it like this:

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