Hello

I am taking input of 2 date as mm/dd/yy format in txtdate1.text and txtdate2.text

Here is the validation I am taking
VB Code:
  1. If ((chkdate(txtdate1.Text) = False) Or (chkdate(txtdate2.Text) = False)) Then
  2. MsgBox "Invalid Date Input.. Please input in the format mm/dd/yy", vbCritical, "Invalid Date"

the chkdate() function is doing the validation as

VB Code:
  1. Public Function chkdate(strdate As Date) As Boolean
  2.     If IsDate(strdate) Then
  3.         If strdate Like Format("##/##/##", "mm/dd/yy") Then
  4.           chkdate = True
  5.         Else
  6.           chkdate = False
  7.         End If
  8.     Else
  9.         chkdate = False
  10.     End If
  11.    
  12. End Function

But even if the date is entered correct it gives error msgbox

what is wrong in code.. please help

also please give me a code which can check that 1st date is lesser than 2nd date inserted

thanks