Range of Dates in a combo box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • truezplaya
    New Member
    • Jul 2007
    • 115

    Range of Dates in a combo box

    I have two text boxes on a form where a user enters a range e.g From and to date. I then wish to display a list of the dates that are inbetween the range entered before in a combo box. I have no idea where to start. I know a little about VB but haven't used it for a while. My preference would be that you point me to a tutorial and then i could learn from this. I am using visual studio 2005
    Cheers in advanced
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Well, user "fatd" will certainly be along in a minute to direct you to the "freetutes" website.

    But in the meantime, I'd suggest you create a variable of type Date. Set it to the From date. Then in a loop, place the value (formatted how you like) into the combo box, use the DateAdd() function to increment the date. Finish the loop when it matches the End date.

    Note that I use VB6 - the detail may vary a bit in later versions.

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      It will be better to use DtPicker control and set the maxdate and mindate property at runtime.

      Comment

      • jimmylee
        New Member
        • Feb 2008
        • 17

        #4
        don't use combo box.
        because date time is not infinity. so. I worry you are so tired.
        pls use datetimepicker control.
        it is so easy to use and more effective.

        Comment

        • akashazad
          New Member
          • Sep 2007
          • 38

          #5
          Originally posted by truezplaya
          I have two text boxes on a form where a user enters a range e.g From and to date. I then wish to display a list of the dates that are inbetween the range entered before in a combo box. I have no idea where to start. I know a little about VB but haven't used it for a while. My preference would be that you point me to a tutorial and then i could learn from this. I am using visual studio 2005
          Cheers in advanced
          Do not use txt boxes insted use datetime picker and then try to fill in the combo box using ADD method .which U can find out in any of the basic vb book

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Originally posted by akashazad
            Do not use txt boxes insted use datetime picker and then try to fill in the combo box using ADD method .which U can find out in any of the basic vb book
            But since the user want to pass the start and end dates at run time ,have to use text boxes. Finally select the date from DTPicker.

            Comment

            Working...