首页 > 解决方案 > How to compare two dates in same DataGridView column

问题描述

How to compare dates in one DataGridView column. I use for loop to do this, but no luck.

for (int i = 0; i < dgv.Rows.Count; i++)
{
    DateTime currDate = Convert.ToDateTime(dgv.Rows[i].Cells["End Date"].Value);

    //index[0] > index[1] 
    //2020-04-04  2020-04-10
    if (currDate > currDate)
    {
        MessageBox.Show("In Progress");
    }
}

标签: c#datagridview

解决方案


推荐阅读