Calculate Age of the Candidate Using Data Picker Control in Visual programming

Procedure: create form using Data Picker Control and command button. Create the two commands Picker control and three text box for show result years month date for the candidate age. One command button to perform the execution. Using the Data picker it will user giver there input month data year. So there birth date and current date are getting by through this method .Finally write the code.
Output of Age calculation in year month date
Calculate Age Candidate Using Data Picker Control
Source CODE Visual Programming Data picker control
Private Sub Command1_Click()
Text1.Text = DTPicker2.Year - DTPicker1.Year
Text2.Text = DTPicker2.Month - DTPicker1.Month
Text3.Text = DTPicker2.Day - DTPicker1.Day
If (DTPicker2.Month < DTPicker1.Month) Then
Text2.Text = Val(Text2.Text) + 12
Text1.Text = Val(Text1.Text) - 1
End If
If (DTPicker2.Day < DTPicker1.Day) Then
Text3.Text = Val(Text3.Text) + 30
Text2.Text = Val(Text2.Text) - 1
End If
End Sub

Related post