Question Month calendar

mansi sharma

Member
Joined
Mar 8, 2009
Messages
16
Programming Experience
Beginner
I want to chane the backColor of particular date.Mine code is only just bold the particular date,but not changing the BackColor.
I have searched on internet,But none of them provide me the Solution. I Found the Below code thru net-
VB.NET:
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
If e.Day.Date.Year = 2004 And e.Day.Date.Month = 10 And e.Day.Date.Day = 14 Then
e.Cell.BackColor = System.Drawing.Color.Yellow
End If
End Sub

this changes the bgcolor of the 14/10/2004.

But there is not DayRender Event in VB.Net..Can Somebody tell me how to do,what i want.

Mine Code is as below-
VB.NET:
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MonthCalendar1.ShowToday = False
        MonthCalendar1.ShowTodayCircle = False
        MonthCalendar1.TitleBackColor = Color.White
        MonthCalendar1.TitleForeColor = Color.Black
        MonthCalendar1.AddBoldedDate(New Date(2009, 3, 12))
        MonthCalendar1.UpdateBoldedDates()
    End Sub
 
As this suggests:
VB.NET:
System.Web.UI.WebControls.DayRenderEventArgs
that code is for a web, i.e. ASP.NET, application, NOT a WinForms application.

The MonthCalendar doesn't support arbitrary background colours for dates. For that you'd have to either create your own control or use an existing third-party control that does provide that support.
 
Back
Top