Hey all, i have the following code to populate a dropdown to coinside with a companies 2008-2010 calander year. This is the output:
2008 Period 1: 11/30/2008 - 12/27/2008
2008 Period 2: 12/28/2008 - 1/24/2009
2009 Period 3: 1/25/2009 - 2/21/2009
2009 Period 4: 2/22/2009 - 3/21/2009
2009 Period 5: 3/22/2009 - 4/18/2009
2009 Period 6: 4/19/2009 - 5/16/2009
2009 Period 7: 5/17/2009 - 6/13/2009
2009 Period 8: 6/14/2009 - 7/11/2009
2009 Period 9: 7/12/2009 - 8/8/2009
2009 Period 10: 8/9/2009 - 9/5/2009
2009 Period 11: 9/6/2009 - 10/3/2009
2009 Period 12: 10/4/2009 - 10/31/2009
2009 Period 13: 11/1/2009 - 11/28/2009
2009 Period 1: 11/29/2009 - 12/26/2009
2009 Period 2: 12/27/2009 - 1/23/2010
2010 Period 3: 1/24/2010 - 2/20/2010
2010 Period 4: 2/21/2010 - 3/20/2010
2010 Period 5: 3/21/2010 - 4/17/2010
2010 Period 6: 4/18/2010 - 5/15/2010
2010 Period 7: 5/16/2010 - 6/12/2010
2010 Period 8: 6/13/2010 - 7/10/2010
2010 Period 9: 7/11/2010 - 8/7/2010
2010 Period 10: 8/8/2010 - 9/4/2010
2010 Period 11: 9/5/2010 - 10/2/2010
and here is the code for it:
Code:
        Dim dt2009Start As DateTime
        Dim dtTempStart, dtTempEnd As DateTime
        Dim dtTempNow As DateTime
        Dim nTemp As Integer
        Dim itemPeriod As ListItem
        Dim timesAround As Integer

        dt2009Start = Convert.ToDateTime("11/30/2008")
        dtTempStart = dt2009Start
        dtTempEnd = dtTempStart.AddDays(27)

        ddlInvoicePeriods.Items.Clear()

        dtTempNow = DateTime.Now()
        nTemp = 1
        timesAround = 0

        While (dtTempNow > dtTempEnd)
            If nTemp = 12 Then
                If timesAround = 0 Then
                    'dtTempStart = Convert.ToDateTime("10/25/2009")
                    'dtTempEnd = Convert.ToDateTime("11/18/2009")
                End If
            ElseIf nTemp = 14 Then
                If timesAround = 0 Then
                    dtTempStart = Convert.ToDateTime("11/29/2009")
                    dtTempEnd = Convert.ToDateTime("12/26/2009")
                    nTemp = 1
                    timesAround += 1
                End If
            End If

            itemPeriod = New ListItem()
            itemPeriod.Text = dtTempStart.Date.Year.ToString() & " Period " & nTemp.ToString() & ": " & dtTempStart.Date.ToShortDateString() & " - " & dtTempEnd.Date.ToShortDateString()
            itemPeriod.Value = dtTempStart.Date.ToShortDateString() & "-" & dtTempEnd.Date.ToShortDateString()
            ddlInvoicePeriods.Items.Add(itemPeriod)
            itemPeriod = Nothing

            Debug.Print(dtTempStart.Date.Year.ToString() & " Period " & nTemp.ToString() & ": " & dtTempStart.Date.ToShortDateString() & " - " & dtTempEnd.Date.ToShortDateString())

            dtTempStart = dtTempEnd.AddDays(1)
            dtTempEnd = dtTempStart.AddDays(27)
            nTemp += 1
        End While

        If nTemp = 12 Then
            dtTempStart = Convert.ToDateTime("12/27/2009")
            dtTempEnd = Convert.ToDateTime("11/18/2009")
        ElseIf nTemp = 13 Then
            dtTempStart = Convert.ToDateTime("11/19/2009")
            dtTempEnd = Convert.ToDateTime("12/16/2009")
        End If

        itemPeriod = New ListItem
        itemPeriod.Text = dtTempStart.Date.Year.ToString() & " Period " & nTemp.ToString() & ": " & dtTempStart.Date.ToShortDateString() & " - " & dtTempEnd.Date.ToShortDateString()
        itemPeriod.Value = dtTempStart.Date.ToShortDateString() & "-" & dtTempEnd.Date.ToShortDateString()
        ddlInvoicePeriods.Items.Add(itemPeriod)
        itemPeriod = Nothing
As you may have noticed, the output only goes to 2010 (10/2/2010) which should go all the way to 12/31/2011.

**Problem being:**

It should start out like so:
2008 Period 13: Nov 30 - Dec 27
2009 Period 1: Dec 28 - Jan 24
2009 Period 2: Jan 25 - Feb 21
2009 Period 3: Feb 22 - Mar 21
...
2009 Period 13: Nov 29 - Dec 26
2010 Period 1: Dec 27 - Jan 23
2010 Period 2: Jan 24 - Feb 20
..
2010 Period 13: Nov 28 - Dec 25
2011 Period 1: Dec 26 - Jan 22
2011 Period 2: Jan 23 - Feb 19
...etc
Any help would be awesome as i am at my end of trying to figure out what i am doing wrong! )

David