title: Format or pad a number column in DataGridView control (DefaultCellStyle.Format)
body: <p>I have a DatagridView control on my form.</p>
  
  <p>The first column is a Record ID which can be between 3 and 5 digits on the db, but should be formatted on the front end as 5 digits with padded zeros/leading zeros.</p>
  
  <p>So it looks like <strong>901</strong> and I want it to look like <strong>00901</strong></p>
  
  <p>I looked at </p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/f9x2790s.aspx" rel="nofollow">MSDN Library: How to: Format Data in the Windows Forms DataGridView Control</a></li>
  </ul>
  
  <p>and</p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/z1cc356h.aspx" rel="nofollow">MSDN Library: How to: Customize Data Formatting in the Windows Forms DataGridView Control</a></li>
  </ul>
  
  <p>and I tried:</p>
  
  <pre><code>dgvDeletedRecords.Columns(0).DefaultCellStyle.Format = "00000"
  </code></pre>
  
  <p>in my form load event after the data is loaded into the grid</p>
  
  <p>But it doesn't work.</p>
  
  <p>Where am I going wrong please?</p>