Results 1 to 7 of 7

Thread: How do you check if a date entered is valid

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153

    Talking

    Hi there how do you check if a date entered into a text box is a valid entry......

    We dont want to use a date picker because they look really odd in our program, any ideas?

    Rohan

  2. #2
    Guest

    Talking IsDate function

    Try this:

    Code:
    Dim sDate As String
    sDate = Text1.Text
    
    If IsDate(sDate) then
        'Enter wanted code here
    End If
    Hope this helps!

  3. #3
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    well, off the top of my head i would:


    1. disallow the entry of letters with the use of isnumeric

    2. check to make sure the propor format was entered
    use instr to find 2 /'s
    3. make sure the months are right
    if month > 12 or month < 12

    4. make sure the days are right
    if days > 31 or days < 0 then

    if Month = 3 then
    if days > 28

    hmm.. that should be about it...

  4. #4
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    damnit..

  5. #5
    Guest

    Talking CWM?

    What's wrong?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153

    Talking Forgot about IsDate

    I think he forgot about the IsDate function.....

  7. #7
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    heh, ya, that's it, i just forgot about it... heh, damn only having one class of vb...

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