Israel

Israel

  • 700
  • 1.3k
  • 217.6k

DateTimePicker

Sep 2 2014 1:25 PM
Hi!
I need to get the exact age of each worker.
I do something very and very simple. Its works but it'snt professional.
On my form I put three textboxs with a button (txtCurrentYear, txtYearOfBorn, txtAge and btnAdd). Then see my code:
 
private void btnAdd_Click(object sender, EventArgs e)
{
float first;
float second;
float output;
first = Convert.ToInt32(txtCurrentYear.Text);
second = Convert.ToInt32(txtYearOfBorn .Text);
output = first - second;
txtAge.Text = output.ToString();
}
What I need to learn. I would like to use the "dateTimePicker" with a "label". Means when I choose a date on my DateTimePicker its should show on my "label" the age (ex. 39)
 
Thanx,
Israel.

Answers (3)