title: Validate the date format in vb.net
body: <p>I have the grid cell value to validate for a correct format as below</p>
  
  <p>Date value should be in <code>DD-MON-YYYY</code> format and for this i am using below validation</p>
  
  <pre><code>Public Function ValidateDateForError(ByVal checkInputValue As String) As Boolean
     Dim returnError As Boolean
      Dim dateVal As DateTime
      If Date.TryParseExact(checkInputValue, "DD-MON-YYYY",
             System.Globalization.CultureInfo.CurrentCulture, 
             DateTimeStyles.None, dateVal) Then
          returnError = True
      Else
          MessageBox.Show("not converted")
      End If
      Return returnError
  End Function`
  </code></pre>
  
  <p>DateTime value should be in <code>DD-MON-YYYY HH:MI:SS</code> format and for this i am using below validation</p>
  
  <pre><code>Public Function ValidateDateTimeForError(ByVal checkInputValue As String) As Boolean
      Dim returnError As Boolean
      Dim dateVal As DateTime
      If DateTime.TryParseExact(checkInputValue, "DD-MON-YYYY HH:MI:SS",
              System.Globalization.CultureInfo.CurrentCulture, 
              DateTimeStyles.None, dateVal) Then
          returnError = True
      End If
      Return returnError
  End Function`
  </code></pre>
  
  <p>EDate (valid European date) value should be in <code>DD/MM/YY</code> format and for this i am using below validation</p>
  
  <pre><code> Public Function ValidateEDateForError(ByVal checkInputValue As String) As Boolean
      Dim returnError As Boolean
      Dim dateVal As Date
      If Date.TryParseExact(checkInputValue, "DD/MM/YY",
             System.Globalization.CultureInfo.CurrentCulture, 
             DateTimeStyles.None, dateVal) Then
          returnError = True
      End If
      Return returnError
  End Function`
  </code></pre>
  
  <p>JDate (valid Julian date) value should be in <code>MM/DD/YY</code> format and for this i am using below validation</p>
  
  <pre><code> Public Function ValidateJDateForError(ByVal checkInputValue As String) As Boolean
      Dim returnError As Boolean
      Dim dateVal As Date
      If Date.TryParseExact(checkInputValue, "MM/DD/YY",
             System.Globalization.CultureInfo.CurrentCulture, 
             DateTimeStyles.None, dateVal) Then
          returnError = True
      End If
      Return returnError
  End Function`
  </code></pre>
  
  <p>but none of above is working. could anyone tell me where i am making mistake?</p>
  
  <p>Thanks in Advance.</p>