Results 1 to 4 of 4

Thread: validating a date picker in vb6.0

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    validating a date picker in vb6.0

    Hallo guys,
    I'm still knew in vb and would like to know how to validate a date picker.
    For example I have a date picker in one of my forms and would like it not to allow the user to choose a date before last year. A typical example I'd not want the user to choose 1890 as the year of birth. Thanks in advance

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: validating a date picker in vb6.0

    Welcome to VBForums

    For that kind of thing, you don't actually need to validate it at all - just tell it do that for you, by setting apt values in the MinDate and MaxDate properties (which by default are #01/01/1601# and #12/31/9999#).

    That has the bonus of not only validating, but also stopping the user from even selecting invalid values in the first place.

  3. #3
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: validating a date picker in vb6.0

    DTPicker has two properties, MaxDate and MinDate. You can set these properties to whatever values you like.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  4. #4
    Addicted Member
    Join Date
    Mar 2008
    Posts
    143

    Re: validating a date picker in vb6.0

    use dtpicker1.mindate to define the minimum available date and dtpicker1.maxdate to define maximum available date, use datediff() function to validate the given date
    HTH

    EDIT: :-) just a few mins behind

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