help pls i need someone that can help me when i enter the date of birth using the datetimepicker box it automatically compute the age and output in a textbox.text
arjen
0
Junior Poster in Training
Recommended Answers
Jump to PostDim myCoolBirthday As Date = DateTimePicker1.Value.Date '// selected value from DateTimePicker. Dim currentDate As Date = Today '// value of current date. Dim myAge As Integer = currentDate.Year - myCoolBirthday.Year '// subtract years from current date. MsgBox("My age: " & myAge & vbNewLine & "Just don't tell …
Jump to PostPrivate Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged Dim Age As Double = Math.Floor(DateDiff(DateInterval.Month, DateTimePicker1.Value, System.DateTime.Now) / 12) TextBox1.Text = "Your age is: " & Age End Sub
All 8 Replies
codeorder
197
Nearly a Posting Virtuoso
arjen
0
Junior Poster in Training
arjen
0
Junior Poster in Training
arjen
0
Junior Poster in Training
samuel_1991
0
Junior Poster in Training
arjen
0
Junior Poster in Training
codeorder
197
Nearly a Posting Virtuoso
anaszaheerp
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.