title: <VB> Highlighting Selected dates from database in Calendar control
body: <p>I am currently using VB. I want to do a Calendar Control which have dates highlighted/selected. All these dates are retrieved from a database.</p>
  
  <p>First thing I need to know is how to put all the dates into an array
  Second thing I need to know is how to highlight all the dates in the array.</p>
  
  <p>I have done some research on the internet and they said something about selectedDates and selectedDates collection and dayrender. But frankly speaking, I can't really find any VB codes regarding this. Dates format will be in dd/MM/yyyy</p>
  
  <pre><code>    Imports System.Data.SqlClient
  
      Partial Class _Default
  Inherits System.Web.UI.Page
  
  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
      Dim connectionString As String = ConfigurationManager.ConnectionStrings("CleanOneConnectionString").ConnectionString
      Dim connection As SqlConnection = New SqlConnection(connectionString)
      connection.Open()
      Dim sql As String = "Select schedule From OrderDetails Where schedule is not null"
      Dim command As SqlCommand = New SqlCommand(sql, connection)
      Dim reader As SqlDataReader = command.ExecuteReader()
      If (reader.Read()) Then
          If (reader.HasRows) Then
              While reader.Read()
                  myCalendar.SelectedDates.Add(CType(reader.GetDateTime(0), Date))
              End While
          End If
      End If
      reader.Close()
      connection.Close()
      myCalendar.SelectedDayStyle.BackColor = System.Drawing.Color.Red
  End Sub
      End Class
  </code></pre>
  
  <p>My Calendar</p>
  
  <pre><code>    &lt;asp:Calendar ID="myCalendar" runat="server" ShowGridLines="True"&gt;
  &lt;/asp:Calendar&gt;
  </code></pre>
  
  <p>Updated with what I have done, but still does not show
  Thanks for the help</p>