تفضل اخي هذا الدوال تعدل text الى الذي تريده تاتي"/" من اليوم وتاتي بعد رقمين من الشهر
PHP كود :
Public Sub AutoDate(TextBoxName As TextBox, ByVal keyasci As Integer) If Val(keyasci) = 8 Then If TextBoxName.Text = Empty Then i = 0 Else i = i - 1 End If Exit Sub End If i = i + 1 If i = 3 Then t1 = Mid(TextBoxName.Text, 1, 2) t2 = Mid(TextBoxName.Text, 3, 1) TextBoxName.Text = Trim$(t1) & "/" & t2 TextBoxName.SelStart = 4 t2 = Empty ElseIf i = 6 Then t1 = Mid(TextBoxName.Text, 1, 5) t2 = Mid(TextBoxName.Text, 6, 1) TextBoxName.Text = Trim$(t1) & "/" & t2 TextBoxName.SelStart = 7 End If If i = 11 Then Exit Sub End Sub
PHP كود :
Public Function DateValidation(TextBoxName As TextBox) As Boolean If IsDate(Trim$(TextBoxName.Text)) = False Then MsgBox "Enter valid date in dd/mm/yyyy format.", vbInformation, "System Info.." TextBoxName.SetFocus DateValidation = False ElseIf Not Len(Trim$(TextBoxName.Text)) = 10 Then MsgBox "Enter valid date in dd/mm/yyyy format.", vbInformation, "System Info.." TextBoxName.SetFocus DateValidation = False Else DateValidation = True End If End Function
Private Sub Txt_Second_Name_KeyPress(KeyAscii As Integer) Call AutoDate(Text1, 0) End Sub Private Sub Txt_Second_Name_LostFocus() Call DateValidation(Text1) End Sub