private void UpdateGrid() { dayTimeTableDataGrid.Rows.Clear(); List <DayTimeSet> currDayTimeSet = calendarManager.GetNewDayTimeSetList(); foreach (DayTimeSet dts in currDayTimeSet) { dayTimeTableDataGrid.Rows.Add(dts.StartTime.ToString() + " - " + dts.EndTime.ToString()); } List <CalendarTimeRow> currCalendarTimeRows = calendarManager.GetNewCalendarTimeRowsByDate(currDate); foreach (CalendarTimeRow ctr in currCalendarTimeRows) { DataGridViewRow currRow = dayTimeTableDataGrid.Rows[calendarManager.DayTimeSetIdToIndex((int)ctr.TimeId)]; DataGridViewComboBoxCell cbc = currRow.Cells[1] as DataGridViewComboBoxCell; cbc.Value = calendarManager.GetComboBoxValueByTrainingGroupId(ctr.Lane1); cbc = currRow.Cells[2] as DataGridViewComboBoxCell; cbc.Value = calendarManager.GetComboBoxValueByTrainingGroupId(ctr.Lane2); cbc = currRow.Cells[3] as DataGridViewComboBoxCell; cbc.Value = calendarManager.GetComboBoxValueByTrainingGroupId(ctr.Lane3); cbc = currRow.Cells[4] as DataGridViewComboBoxCell; cbc.Value = calendarManager.GetComboBoxValueByTrainingGroupId(ctr.Lane4); cbc = currRow.Cells[5] as DataGridViewComboBoxCell; cbc.Value = calendarManager.GetComboBoxValueByTrainingGroupId(ctr.Lane5); cbc = currRow.Cells[6] as DataGridViewComboBoxCell; cbc.Value = calendarManager.GetComboBoxValueByTrainingGroupId(ctr.Lane6); } }