title: How to calculate age in years from dob in c#
body: <pre><code>   private void button1_Click(object sender, EventArgs e)
      {
          DateTime dob = new DateTime();
          textBox1.Text = dob.ToString();
          int age;
          age = Convert.ToInt32(textbox2.Text);
          age = DateTime.Now.Year - dob.Year;
          if (DateTime.Now.DayOfYear &lt; dob.DayOfYear)
              age = age - 1;
  
      }
  </code></pre>
  
  <p>How to claculate the age from dob.This is my form1.cs.any ideas please</p>