Skip to Content
author's profile photo Former Member
Former Member

COMPARE DATES

Hi....

I have created a form using screen painter. In that i have assigned a textbox for date as date field. The user can enter the current date or the date which is lesser than current date while adding or updating. It should not allow the user, to enter the date which is greater than current date.

Regards

Roseline.B

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2009 at 07:13 AM

    Hi Roseline,

    In the Lost_Focus Event, for that particular field, you can make a check if the date is greater than the current date and if so, you can get the focus back to the date field and give a msg to the user asking him to enter the current date or a previous date.

    Hope this helps.

    Regards,

    Satish. B.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I am doing in vb.net. In the message box itself it is showing error. I am getting the date value in the text box. The value is showing as string like this '20090915' if the date is '15/09/2009'. So I put

      ODate1=otext.value

      In that It shows a error as

      "Conversion from '15/09/2009' to string is not valid

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2009 at 08:06 AM

    Hi,

    Follow what Satish and Kevin said, and just in case if ur stuck in the comparision of the dates.. Check the following links.

    http://stackoverflow.com/questions/618878/vb-net-compare-just-the-date-part-and-not-the-time-of-two-dates

    http://visualbasic.ittoolbox.com/groups/technical-functional/vb-dotnet-l/comparing-dates-in-vb-net-1616166

    http://www.dreamincode.net/forums/showtopic63297.htm

    U can find even more samples in google.

    Happy Coding..

    Vasu Natari.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.