title: Set value as age instead of date of birth in a datagridview column
body: <p>I have a DataGridview in a windows forms. I have a field DOB (Date Of Birth) as DateTime, I want to display Age instead of displaying the DOB.
  Example: DOB is 13.06.2007 I want to display 10. 
  I have a method that calculates the age from the DOB, how can i assign it to the coulmn. ?</p>
  
  <pre><code>private void bindToGrid(DataTable dtb)
  {
     using (dtb)
     {
         dataGridView1.DataSource = dtb;
  
         dataGridView1.Columns[2].Name = "Age";
         dataGridView1.Columns[2].HeaderText = "Age";
         dataGridView1.Columns[2].DataPropertyName = "DOB";
      }
  }
  
  public static string getAge(DateTime dob)
  {
      var today = DateTime.Today;
      var age = today.Year - dob.Year;
  
      if (dob &gt; today.AddYears(-age))
          age--;
      return age.ToString();
  }
  </code></pre>