|
-
May 30th, 2011, 12:18 AM
#1
Thread Starter
Hyperactive Member
-
May 30th, 2011, 12:24 AM
#2
Re: Random exception thrown when setting valid month values.
Just because you are using a valid month value, doesn't mean that the combination of year, month and day values represents a valid date. Presumably the day is not valid for the month.
-
May 30th, 2011, 09:36 AM
#3
Thread Starter
Hyperactive Member
Re: Random exception thrown when setting valid month values.
Thanks jmcilhinney with that in mind I'll dig a little deeper into this. I'm still unsure of why my day's would be invalid for a particular month when I've created a function to return the length of any given month even for leap year. All values for which are returning correctly.
-
May 30th, 2011, 11:52 AM
#4
Re: Random exception thrown when setting valid month values.
Check what are the values of .day and .year before you set .month to i+1.
What properties and how they initialized in a NEW AppointmentBookControl
Last edited by kaliman79912; May 30th, 2011 at 11:56 AM.
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
May 30th, 2011, 06:41 PM
#5
Re: Random exception thrown when setting valid month values.
There's already a function to return the length of any given month even for leap years, i.e. Date.DaysInMonth.
The exception says that the year, month and day are not a valid date. What are the year month and day values when the exception is thrown? That should obviously be the first thing you look at, given that that's what the exception refers to specifically.
-
May 30th, 2011, 09:40 PM
#6
Thread Starter
Hyperactive Member
Re: Random exception thrown when setting valid month values.
I figured it out! I checked which month was causing the exception and it turned out to be February. So from there I broke it down to see which date was actually trying to be set as a date that was invalid. So I found from within my calendar control that I had a property for day, which now I'm unsure of why I even had it to begin with.. However though this value was being initialized along side the calendars value property which initialized as today's date then can be changed accordingly by run time or design time. When I changed the month property, the day value gets passed too so when it was time for February the day being passed was today of course, the 30th. Which is not a valid date for February.
The 'Date.DaysInMonth' function I did not know of. I'm actually still in the process of migrating to .net from many many years of working with vb6, so you can understand that I'm used to doing things myself lol
Thanks for all your help guys!
Last edited by DavesChillaxin; May 30th, 2011 at 09:44 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|