or
Private Sub FillCalendar() Dim newFont = New Font("Calibri", 7.0F, FontStyle.Bold) Dim EE As Integer Dim vbYear As Integer Dim Incident As String Dim ColIndex As Integer 'Day of the month, also the name of the column Dim RowIndex As Integer ' Month of the year, also row index + 1 EE = CInt(RadTextBoxElement10.Text) ' Employee id # vbYear = CInt(RadDropDownListElement1.SelectedIndex + 2007) 'Year for calendar 'connection string and mysqlconnect Dim connstring As String = ("Data Source=MyServer\SQLINSTANCE;Initial Catalog=DATABASENAME;Persist Security Info=True;User ID=MYUSER;Password=MYPASS") Dim conn As New SqlConnection(connstring) Dim selectSQL As String 'create selection query selectSQL = ("Select aDay, aMonth, Incidents From View_AttCombined Where (GPID like '" & EE & "') and (aYear like '" & vbYear & "')") 'create selection command Dim cmd As New SqlCommand(selectSQL, conn) 'set cmd property cmd.CommandType = CommandType.Text 'open database conn.Open() 'create and execute the reader Dim myreader As SqlDataReader = cmd.ExecuteReader While myreader.Read ColIndex = myreader.GetInt32(0) RowIndex = myreader.GetInt32(1) - 1 Incident = myreader.GetString(2) Me.RadGridView1.Rows(RowIndex).IsCurrent = True Me.RadGridView1.Columns(ColIndex).IsCurrent = True Me.RadGridView1.CurrentCell.Value = Incident If Len(Me.RadGridView1.CurrentCell.Value) > 3 Then Me.RadGridView1.CurrentCell.Font = newFont Else End If End While conn.Close() Me.AttendanceTableAdapter.Fill(Me.AttendanceDataSet.Attendance, CInt(RadTextBoxElement10.Text), CInt(RadDropDownListElement1.SelectedIndex + 2007)) Me.AttCalCommentsTableAdapter.Fill(Me.CalCommentDataSet.AttCalComments, CInt(RadTextBoxElement10.Text), CInt(RadDropDownListElement1.SelectedIndex + 2007)) Me.RadGridView1.CurrentRow = Me.RadGridView1.Rows(0) Me.RadGridView1.CurrentColumn = Me.RadGridView1.Columns(1) End Sub