By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,964 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,964 IT Pros & Developers. It's quick & easy.

Range of Dates in a combo box

100+
P: 115
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
Feb 4 '08 #1
Share this Question
Share on Google+
5 Replies


Expert 5K+
P: 8,434
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.
Feb 5 '08 #2

debasisdas
Expert 5K+
P: 8,127
It will be better to use DtPicker control and set the maxdate and mindate property at runtime.
Feb 5 '08 #3

P: 17
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.
Feb 5 '08 #4

akashazad
P: 38
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
Feb 5 '08 #5

debasisdas
Expert 5K+
P: 8,127
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.
Feb 5 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.