我的系统时钟是9/16/2014(星期二)
但在代码中,我总是跳到星期一。
DayOfWeek dow = DateTime.Now.DayOfWeek;
int columnNumber = 0;
columnNumber = columnNumber + 0;
foreach ( DataGridViewRow row in dataGridView1.Rows )
{
switch ( dow )
{
case DayOfWeek.Monday:
columnNumber = 4;
if (Int32.Parse(row.Cells[columnNumber].Value.ToString()) == 1)
{
row.Cells["activeTodayDataGridViewCheckBoxColumn"].Value = true;
}
break;
我有DataGridView
Text
DataGridViewCheckBoxColumn
答案 0 :(得分:0)
尝试插入
if (row.IsNewRow) continue;
foreach和switch之间的