Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ToString method of Recurrence class (Read 2637 times)
Bud Staniek
Guest


ToString method of Recurrence class
Jul 23rd, 2006 at 11:11am
Print Post  
This is a really minor problem, but an off-by-one error occurs within the Recurrence class' ToString method when the Pattern is set to Yearly. The error causes ToString to misinterpret the value for the DayOfMonth property. By design, the DayOfMonth must be an Integer between 1 and 12. By contrast, the ToString method (apparently) uses a zero-based array to store the names of the months, but does not correct for the 1-based DayOfMonth value. For example, the procedure below should popup a MessageBox with the text "Occurs every January 1 effective..."

    Public Sub TestRecurrenceToString()
       Dim rec As New MindFusion.Scheduling.Recurrence

       rec.Pattern = MindFusion.Scheduling.RecurrencePattern.Yearly
       rec.MonthOfYear = 1

       MessageBox.Show(rec.ToString)

    End Sub


Instead the message reads "Occurs every February 1 effective..."

Also, as I was playing around this little conundrum, I tried setting the MonthOfYear to zero and got the following exception Message, obviously a refugee from the StartHour() property procedure:

'0' is not a valid value for 'StartHour'. 'StartHour' must be greater than or equal to '1' and less than or equal to '12'.
Parameter name: value

Like I said, this is a minor problem because the ToString method is not critical to the internal workings of the Recurrence class. But I like it because it generates a nice descriptive string which the user can understand.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ToString method of Recurrence class
Reply #1 - Jul 24th, 2006 at 4:49am
Print Post  
We will fix that in the next release.

Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint