ho un problema nel codice seguente, praticamente se eseguo il seguente codice all' interno del mese questo esegue la sua funzione correttamente, ma logicamente se eseguo un' operazione a cavallo tra la fine e l'inizio del mese successivo questo vā in errore in quanto Date.DaysInMonth si trova al di fuori dei suoi giorni come posso gestire l' aggiunta di Date.DaysInMonth del mese successivo?

txtnumero.Text č un numero di giorni

codice:
             ListBox6.Items.Clear()
             For i As Integer = Mid(txtData.Text, 1, 2) To Date.DaysInMonth(Mid(Date.Today.Year, 3, 2), Date.Today.Month)
                Dim d = i.ToString("00") & "/" & Date.Today.Month.ToString("00") & "/" & Mid(Date.Today.Year, 3, 2)
                If Convert.ToDateTime(d).DayOfWeek <> DayOfWeek.Sunday Then
                    Application.DoEvents()
                    ListBox6.Items.Add(d)
                End If
            Next
            For n As Integer = ListBox6.Items.IndexOf(ListBox6.Items(0)) To txtnumero.Text - 1
                Application.DoEvents()
                ExecSql("INSERT INTO ore VALUES ('" & ListBox6.Items.Item(n) & "','" & Me.CboAltro.Text & "','" & "**.**" & "','" & "**.**" & "','" & "06:00" & "')")
            Next