Based on the date that the user selects, I'm trying to make the
MonthCalendar control highlight the entire week. In my case, the week
is from Monday - Sunday. I thought that using AddBoldedDate along
with selectionrange. start and .end would accomplish this, but it
doesn't.
Here is my code:
Private Sub MonthCalendar1_ DateChanged(ByV al sender As System.Object,
ByVal e As System.Windows. Forms.DateRange EventArgs) Handles
MonthCalendar1. DateChanged
Dim dateToday As Date = MonthCalendar1. SelectionRange. Start
Dim LastMonday As Date
Select Case dateToday.DayOf Week
Case DayOfWeek.Monda y
LastMonday = MonthCalendar1. SelectionRange. Start
Case DayOfWeek.Tuesd ay
LastMonday =
MonthCalendar1. SelectionRange. Start.AddDays(-1)
Case DayOfWeek.Wedne sday
LastMonday =
MonthCalendar1. SelectionRange. Start.AddDays(-2)
Case DayOfWeek.Thurs day
LastMonday =
MonthCalendar1. SelectionRange. Start.AddDays(-3)
Case DayOfWeek.Frida y
LastMonday =
MonthCalendar1. SelectionRange. Start.AddDays(-4)
Case DayOfWeek.Satur day
LastMonday =
MonthCalendar1. SelectionRange. Start.AddDays(-5)
Case DayOfWeek.Sunda y
LastMonday =
MonthCalendar1. SelectionRange. Start.AddDays(-6)
End Select
With MonthCalendar1
.SelectionRange .Start = LastMonday
.SelectionRange .End = LastMonday.AddD ays(7)
for x = 0 to 6
.AddBoldedDate( LastMonday.AddD ays(x))
next
End With
End Sub
Thanks,
Randy