-
i want the user to insert a date in a text box , amd i dont
want him to insert a number like - 1111111 and i dont want him to insert a string like - aaaaaaaaa so ,
i want him to insert a date of birth in the format of "dd/mm/yy" so i wrote :::
Private Sub txtdateofbirth_LostFocus()
Dim number As Long
Dim word As String
If txtdateofbirth.Text = number Then
MsgBox "àðà äëðñ úàøéê çå÷é", , "úàøéê ìà çå÷é"
ElseIf txtdateofbirth.Text = word Then
MsgBox "àðà äëðñ úàøéê çå÷é", , "úàøéê ìà çå÷é"
Else
If Format(txtdateofbirth, "dd/mm/yy") = txtdateofbirth.Text Then
Exit Sub
Else
MsgBox "àðà äëðñ úàøéê çå÷é", , "úàøéê ìà çå÷é"
txtdateofbirth.Text = ""
txtdateofbirth.SetFocus
Exit Sub
End If
End If
txtdateofbirth = Format(txtdateofbirth, "dd/mm/yy")
End Sub
whats wrong in it ?????????????????
please help and thank you in advance
amit
[Edited by arale on 06-26-2000 at 06:46 AM]
-
Instead of using a TextBox, use a MaskedEdit control.
-
i tried to use the mask edit box but the only prob is i cant lock it .
-
Do this when you want to "lock" the MaskedEdit control.
Code:
Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub