My system clock is 9/16/2014 (Tuesday)
But in code, I'm always jumping to Monday.
DayOfWeek dow = new DateTime().DayOfWeek;
int columnNumber = 0;
columnNumber = columnNumber + 0;
foreach ( DataGridViewRow row in dataGridView1.Rows )
{
switch ( dow )
{
case DayOfWeek.Monday:
columnNumber = 4;
if ( (bool) row.Cells[4].Value == true ) // crashing here with NullReferenceException
{
row.Cells["activeTodayDataGridViewCheckBoxColumn"].Value = true;
}
break;
I have a DataGridView
- Columns 0—3 are
Text
- Columns 4—9 are
DataGridViewCheckBoxColumn