I am in the middle of a Biorhythm VB program and am wondering how to use Date Picker
Currently I am working on a phase of 18 days, so I assume MOD18 will come into it somewhere (you can tell I am a beginner)
My Date Picker seems to go back to Jan 1st 1601
On that day, the 18 day cycle is on day 16 of the 18 day cycle.
So what I need to know is - if I use Date Picker to choose a date of, say, March 9th 1967 - how can I get it to calculate what day of the 18 day cycle March 9th 1967 falls on (still assuming that Jan 1st 1601 is day 16 of the 18 day cycle)
The DTP is a simple control to use (IMO). The only properties I ever modify are the Format (3-dtpCustom), CustomFormat (M/dd/yyy), MinDate (the earliest date you want to allow the user to enter) and MaxDate (the latest date you want to allow the user to enter).
The MinDate and MaxDate should accomodate the range of valid date values for a VB Date datatype: 1/1/100 thru 12/31/9999.
The custom format is the "weird" thing about the control because the way you specify what you want is different from the normal specification of a date format, and it is case sensitive (for example, the equivalent of the date format "m/dd/yyyy" is "M/dd/yyy" for the DTP). Check out the MSDN help file on the DTP for the custom formatting.
At run-time, simply check the Value property of the DTP control to see what the user has entered.
I am attaching a sample app that does what you are looking for. It uses 2 DTPs, one for the origin date, the other for the cycle date to be tested. The crux of the code is: