PDA

Click to See Complete Forum and Search --> : need simple thing quick please !!!


arale
Jun 25th, 2000, 06:52 AM
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]

MartinLiss
Jun 25th, 2000, 08:30 AM
Instead of using a TextBox, use a MaskedEdit control.

arale
Jun 25th, 2000, 05:47 PM
i tried to use the mask edit box but the only prob is i cant lock it .

MartinLiss
Jun 25th, 2000, 09:03 PM
Do this when you want to "lock" the MaskedEdit control.
Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)

KeyAscii = 0

End Sub