non sō se questo metodo sia corretto, ma comunque funziona:
codice:
ListBox1.Items.Clear()
ListBox2.Items.Clear()
Label1.Text = ""
For i As Integer = Mid(TextBox1.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()
ListBox1.Items.Add(d)
End If
Next
For m As Integer = 1 To Date.DaysInMonth(Mid(Date.Today.Year, 3, 2), Date.Today.Month + 1)
Dim s = m.ToString("00") & "/" & (Date.Today.Month + 1).ToString("00") & "/" & Mid(Date.Today.Year, 3, 2)
If Convert.ToDateTime(s).DayOfWeek <> DayOfWeek.Sunday Then
Application.DoEvents()
ListBox1.Items.Add(s)
End If
Next
For j As Integer = 1 To Date.DaysInMonth(Mid(Date.Today.Year, 3, 2), Date.Today.Month + 2)
Dim k = j.ToString("00") & "/" & (Date.Today.Month + 2).ToString("00") & "/" & Mid(Date.Today.Year, 3, 2)
If Convert.ToDateTime(k).DayOfWeek <> DayOfWeek.Sunday Then
Application.DoEvents()
ListBox1.Items.Add(k)
End If
Next
For n As Integer = ListBox1.Items.IndexOf(ListBox1.Items(0)) To ComboBox1.Text - 1
Application.DoEvents()
Label1.Text = ListBox2.Items.Count + 1
ListBox2.Items.Add(ListBox1.Items(n))
Next
Adesso perō mi si presenta il problema dell' anno nel senso che se sono tra la fine e l' inizio dell' anno il programma mi vā chiaramente in errore.
Qualche suggerimento