Fill Back Color of Bold Dates in Month Calendar

  • Thread starter Thread starter wasantha Bandara Rambukwella
  • Start date Start date
W

wasantha Bandara Rambukwella

Guest
I want to fill back color of the bold dates in a month calendar. Dates read from sql server table have been bold in the month calendar. Now I want them to be in a different color. How can I do this? my codes to reflect bold dates in month calendar is as folows.
Imports System.Data.SqlClient

Public Class Operations
Private ConnectionString As String = "Data Source=MyPC;Initial Catalog=MonthCalendarTest;Integrated Security=True"
Public Function LoadDates(ByVal MyId As Integer) As DateTime()
Dim dateList As New List(Of DateTime)

Using cn As New SqlConnection With {.ConnectionString = ConnectionString}

Using cmd As New SqlCommand With {.Connection = cn}
cmd.CommandText = "SELECT e.EventDate FROM dbo.tblEvents AS e where EventID=" & MyId

cn.Open()

Dim reader As SqlDataReader = cmd.ExecuteReader
While reader.Read
dateList.Add(reader.GetDateTime(0))
End While

End Using
End Using
Return dateList.ToArray
End Function

Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ops As New Operations
' MonthCalendar1.AnnuallyBoldedDates = ops.LoadDates


MonthCalendar1.BoldedDates = ops.LoadDates(3)

End sub





End Class

Continue reading...
 
Back
Top