Just consider this window :
Now double click on OK button and write down this code :
private void okButton_Click_1(object sender, EventArgs e)
{
int myAge = DateTime.Today.Year - dateTimePicker1.Value.Year;
textBox1.Text = myAge.ToString();
}
{
int myAge = DateTime.Today.Year - dateTimePicker1.Value.Year;
textBox1.Text = myAge.ToString();
}
Now select a birthday date from dateTimePicker then click OK button.then we can see the result in text box.
OUTPUT :
0 Comments