How can I create a date control that validates and confirms that the user is entering a valid date

How can I create a date control that validates and confirms that the user is entering a date in the right format (mm/dd/yyyy).

I don t want to create functions that validate the data that he user enters by checking that the first 2 digits are less than 12 (meaning it s a valid month).

I guess VB does that automaticaly

(I have VB.NET 2003) and am developping VB windows forms (not asp forms)

I m glad I m now a memeber of this fabulous forum.

Thanks folks

R.Tutus

rtutus@hotmail.com



Answer this question

How can I create a date control that validates and confirms that the user is entering a valid date

  • Wim Heerkens

    Thanks, however, if I use that, in order to pick a year I ll have to naviguate till the year 1975 for example one by one which is not very convenient. I really want some sort of text box where the user enters a date (ex: 10/09/1975) But I want he control to validate if it s a valid month (number between 1 and 12) and valid day of the month (number between 1 and 31 or 30) for example automaticcaly. You now what i m talking about: date controls in windows forms that users enter usually and that do validation.

    Thanks a lot for your help.

  • Asian Dragon

    use the Calendar Control or the DateTimePicker Control

  • VB_Devil

    You really re the man

    Muchas gracias



  • Kerryrob

    how can I make it just a "text box control" and not as a "combo control"; without the scroll down arrow just like a text box and when re we supposed to use instead a "masked Edit control"

    Also, when are we supposed to use the text box versus the pickdate and time control versus the the calendar. What re people usually using to alow users to enter dates "text boxes, MaskEdit


    Thanks


  • dhannawat1

    The datetimepicker control gives you alot of control over the way dates and times are displayed and validated....and you can enter the date just like a normal text box or use the down arrow to get a gui date picker...try it out it may be just what your looking for.

    Big Smile

  • How can I create a date control that validates and confirms that the user is entering a valid date