- Home
·
- Math/Dates
·
- This little program will restrict a date entered to anyone older than 18 years of age.
This little program will restrict a date entered to anyone older than 18 years of age.
This little program will restrict a date entered to anyone older than 18 years of age.
API Declarations
'one label box
'(very good for NIC Generatiing Program)
'take 3 maskedbox on array from
'one command button
'if you found any error plz email me: [email protected]
Rate This little program will restrict a date entered to anyone older than 18 years of age.
(1(1 Vote))
r = (DateValue(MaskEdBox1(0).Text)) - (DateValue(MaskEdBox1(1).Text))
r = r / 365
Label1.Caption = Str$(Round(r, 2))
Select Case Val(Label1.Caption)
Case Is <= (18)
MsgBox "Date Error"
MaskEdBox1(1).SetFocus
Case Else
MaskEdBox1(2).SetFocus
End Select
End Sub
Private Sub MaskEdBox1_GotFocus(Index As Integer)
MaskEdBox1(Index).Mask = "##-##-####"
MaskEdBox1(Index).ForeColor = vbRed
End Sub
Private Sub MaskEdBox1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub
Private Sub MaskEdBox1_LostFocus(Index As Integer)
MaskEdBox1(Index).ForeColor = vbBlue
MaskEdBox1(Index).Text = Format$(CVDate(MaskEdBox1(Index).Text), "dd-mm-yyyy")
MaskEdBox1(Index).Text = Format$(CVDate(MaskEdBox1(Index).Text), "dd-mm-yyyy")
End Sub
This little program will restrict a date entered to anyone older than 18 years of age. Comments
No comments yet — be the first to post one!
Post a Comment