Okay so I just got my first contract job... from my wife. (Dun Dun DUNN!)

My wife works in clinical research and spends a lot of time traveling and scheduling site visits for her job. She asked me if I could write a program for her that would give her the site visit windows for her sites given an initial date visit.

That seemed simple enough and VB seemed like an easy way to do it (my skill set currently amounts to some VB and C++, I'm a student). It would be simple enough to just create a program that just converts all the days of the year to an integer between 1 and 365 (skipping leap years for now) and then add the appropriate amount of time to said integer and then reconvert and display a date range centered on the new site visit:

i.e. (in (bad) psuedocode.)

Set InitialSiteVisit from user input //ex. 1/1/2011

Convert date to integer between 1 and 365 //ex. 1/1/2011 converts to 1

OneMonthVisit = InitialSiteVisit + 30  //ex. 1/31/2011

OneMonthVisitWindow = ThreeMonthVisit +/- 7 //ex. 1/24/2011 to 2/6/2011

(If the added time kicked the integer over 365 i'd just increment the year and start from 1 again.)

I hope that makes sense.

Anyway, I start playing around in VS and see some nifty calendar controls. And I think I could take this from 'meh' to 'kinda spiffy' by adding some graphic calender stuff. I'm thinking of having the visit windows displayed as a range of dates highlighted on a MonthCalender control, derived from a DateTimePicker control, and the site visit (3 month, 6 month, etc.) chosen from a drop down menu.

So here's the problem, I've never really messed with these calendar controls, but just in goofing around with them, I've noticed a couple things:

  • There's a built in 'Date' datatype. That obviously seems quite useful but I don't know anything about it. (Will be reading up on as soon as I post this)
  • The MonthCalendar has a SelectRange property that can do the highlighting I want for the display.
  • There's a checked property in the DateTimePicker control. Not sure how to turn that from a bool to a Date type or some other useful conversion. (Again, will be reading up.)

I'm assuming the DateTimePicker.checked bool is just like one of many check boxes in the control, but what I would need to get from it is the actual date that is selected (can it be converted to a date type?)

I also would need a way to set the SelectionRange property centered on a central date with changing number of days before/after (i.e. "± 7 days centered on 1/31/2011 = 1/24/2011 to 2/7/2011.")

Ideally, I'd like the SelectRange not to highlight the weekends (as she doesn't generally travel then) but that's something I can live without.

Any thoughts or ideas? Any help is much obliged.

(Hope I followed the posting rules, first timer)


5 Years
Discussion Span
Last Post by kroysemaj

I just relized there's a separate forum for VB6. Is that where this should go?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.