Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.MaskedTextBox1.Mask = "00/00/0000" Me.MaskedTextBox1.ValidatingType = GetType(System.DateTime) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ddd, mmm, yyy As String ddd = Mid(MaskedTextBox1.Text, 1, 2) If Len(Trim(ddd)) < 2 Then ddd = "0" & Trim(ddd) End If mmm = Mid(MaskedTextBox1.Text, 4, 2) If Len(Trim(mmm)) < 2 Then mmm = "0" & Trim(mmm) End If yyy = Mid(MaskedTextBox1.Text, 7, 4) If Len(Trim(yyy)) < 4 Then MsgBox("الرجاء ادخال السنة بالتاريخ الصحيح") Else Dim rr As Date rr = CDate(ddd & "/" & mmm & "/" & yyy) MaskedTextBox1.Text = Format(rr, "dd/MM/yyyy") End If End Sub