by Ednalin D. Layugan (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 3rd May 2009
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Getting your exact age just in a simple code
API Declarations
' Create/Draw a textbox in your form for your age
'Bauan East, Solana, Cagayan Philippines 3503
'[email protected]
Private Sub txtbday_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If IsDate(txtbday.Text) Then
txtage.Text = Int(DateDiff("d", txtbday.Text, Date) / 365.25)
Else
MsgBox "Enter the correct date format, mm/dd/yyyy"
txtbday.Text = ""
End If
End If
End Sub