VB.NET code:
Private Sub FormatDates()
Dim d = New DateItem(4) {}
d.Initialize
For i = 0 To 5 - 1
d(i) = New DateItem
Next
d(0).Date = New DateTime(2005, 6, 3)
d(0).BackColor1 = Color.Red
d(0).ImageListIndex = 3
d(0).Text = "Help"
d(1).Date = New DateTime(2005, 6, 12)
d(1).ImageListIndex = 2
d(2).Date = New DateTime(2005, 6, 16)
d(2).BackColor1 = Color.LightBlue
d(2).ImageListIndex = 8
d(3).Date = New DateTime(2005, 6, 18)
d(3).BackColor1 = Color.GreenYellow
d(3).ImageListIndex = 1
d(3).Text = "NorDev"
d(4).Date = New DateTime(2005, 6, 22)
d(4).ImageListIndex = 1
d(4).Text = "Cebit"
monthCalendar1.AddDateInfo(d)
End Sub
C# code:
private void FormatDates()
{
DateItem[] d = new DateItem[5];
d.Initialize();
for (int i = 0;i<5;i++)
d[i] = new DateItem();
d[0].Date = new DateTime(2005,6,3);
d[0].BackColor1 = Color.Red;
d[0].ImageListIndex = 3;
d[0].Text = "Help";
d[1].Date = new DateTime(2005,6,12);
d[1].ImageListIndex = 2;
d[2].Date = new DateTime(2005,6,16);
d[2].BackColor1 = Color.LightBlue;
d[2].ImageListIndex = 8;
d[3].Date = new DateTime(2005,6,18);
d[3].BackColor1 = Color.GreenYellow;
d[3].ImageListIndex = 1;
d[3].Text = "NorDev";
d[4].Date = new DateTime(2005,6,22);
d[4].ImageListIndex = 1;
d[4].Text = "Cebit";
monthCalendar1.AddDateInfo(d);
}
Don't forget to add the month calendar as a reference in the project!