title: How to get age of person and put it on dataGrid at run time without save it in database?
body: <p>I'm working in C# application, I have a <code>dataGridViewX1</code> which has a column called <code>Birthday</code> with an index number [3].</p>
  
  <p>I want to add a new column at runtime to <code>dataGridViewX1</code> called <code>Age</code> with an index number [17].</p>
  
  <p>How do I calculate the age and put it in column <code>Age</code>. I did this code but the error appears to me and said </p>
  
  <blockquote>
    <p>Column cannot be added because its CellType property is null.</p>
  </blockquote>
  
  <p>CellType is (gets) not Gets or Sets. I Cant put a value to it, like below.</p>
  
  <blockquote>
    <p>col.CellType = typeof(int x)</p>
  </blockquote>
  
  <p>This is my code:</p>
  
  <pre><code>DataGridViewColumn col = new DataGridViewColumn();
  col.HeaderText = "Age";
  col.Name = "ageBoD";
  int colIndex = dataGridViewX1.Columns.Add(col);
  
  DateTime brithday;
  for (int i = 0; i &lt; dataGridViewX1.Rows.Count; i++)
  {
      brithday = (DateTime)dataGridViewX1[3, i].Value;
      TimeSpan age = DateTime.Now - brithday;
      dataGridViewX1[17, i].Value = age.Days / 365;
  }
  </code></pre>
  
  <p>If I did this code:</p>
  
  <pre><code>        DataGridViewColumn col = new DataGridViewTextBoxColumn();//This only has been changed.
          col.HeaderText = "Age";
          col.Name = "ageBoD";
          int colIndex = dataGridViewX1.Columns.Add(col);
  
          DateTime brithday;
          for (int i = 0; i &lt; dataGridViewX1.Rows.Count; i++)
          {
              brithday = (DateTime)dataGridViewX1[3, i].Value;
              TimeSpan age = DateTime.Now - brithday;
              dataGridViewX1[17, i].Value = age.Days / 365;
  
          }
  </code></pre>
  
  <p>the error is hide and gone, and the column has been added successfully . But another problem has been occur which is no data in that column.</p>