title: Trying to pad decimal number with leading spaces
body: <pre><code>for (int iCount = 0; iCount &lt; oForm.LineItems.Count; iCount++)
             {
  </code></pre>
  
  <p>// cartDetails is a stringbuilder here.</p>
  
  <pre><code>     cartDetails.Append(String.Format("{0:0}", oForm.LineItems[iCount].Quantity));
       cartDetails.Append(String.Format("{0:0.00}", oForm.LineItems[iCount].Price));
       cartDetails.Append(String.Format("{0:0.00}", oForm.LineItems[iCount].ExtendedPrice));
  
       //cartDetails.Append(string.Format("{0,10:#,##0.00}", oForm.LineItems[iCount].Price) + "&lt;/TD&gt;&lt;TD&gt;");
       //cartDetails.Append(string.Format("{0,10:#,##0.00}", oForm.LineItems[iCount].ExtendedPrice) + "&lt;/TD&gt;&lt;TD&gt;");
       //cartDetails.Append(String.Format("{0}", oForm.LineItems[iCount].Quantity).PadLeft(4)+ "&lt;/TD&gt;&lt;TD&gt;");
       //cartDetails.Append(String.Format("{0:0.00}", oForm.LineItems[iCount].Price).PadLeft(8) + "&lt;/TD&gt;&lt;TD&gt;");
  </code></pre>
  
  <p>I have pastd the source code I am using. I add qty, price, extendedprice and all are decimal columns. All I am looking to do is to pad left with leading spaces. Decimal rounding to 2 digits seems to be happening.</p>
  
  <p>Those commented lines above are some of the other options I have tried.
  Currently if qty has values such as 4 and 40, they don't get aligned when I print them in a table. Same with price.</p>
  
  <p>CAn someone please suggest what am I doing here?</p>
  
  <p><strong>Update1:</strong> Tried Lucas suggestion, but it is not working. Here is what I am geting.</p>
  
  <p>cartDetails.Append(String.Format("{0:0,10}", oForm.LineItems[iCount].Quantity)); </p>
  
  <p>When I try the above, it shows 10 for every line irrespective of the value in oForm.LineItems[iCount].Quantity. </p>
  
  <p>And if I change 
  String.Format("{0:0,4}", it shows 04 for all the records</p>