Results 1 to 5 of 5

Thread: [RESOLVED] How do I validate a date that has been inputted to make sure it's in the correct form

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    55

    Resolved [RESOLVED] How do I validate a date that has been inputted to make sure it's in the correct form

    Hi,
    I have a bit of code which assigns a user input to a variable of data type string; this is done simply by using an Input Box. I need to validate the input so that firstly, it only accepts dates, and secondly so that it is in the form dd/MMM/yyyy. What's the best way of doing this? Can I somehow get a DateTimePicker in an input box without creating a new form?
    Thanks

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,539

    Re: How do I validate a date that has been inputted to make sure it's in the correct

    No, you cannot get a DTP into an input box unless you create your own form... which relly isn't all that difficult.

    but at any rate, use DateTime.ParseExact to determine if the date entered is in the correct format.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    55

    Re: How do I validate a date that has been inputted to make sure it's in the correct

    Quote Originally Posted by techgnome View Post
    No, you cannot get a DTP into an input box unless you create your own form... which relly isn't all that difficult.

    but at any rate, use DateTime.ParseExact to determine if the date entered is in the correct format.


    -tg
    Can you give me an example?

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,539

    Re: How do I validate a date that has been inputted to make sure it's in the correct

    no. because there is a perfectly good one at the link i provided.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    55

    Re: How do I validate a date that has been inputted to make sure it's in the correct

    Quote Originally Posted by techgnome View Post
    no. because there is a perfectly good one at the link i provided.

    -tg
    Ahh didn't realize there was a link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width