我目前有一个DataGridView绑定到从XML文件读取的DataSet。
填充DataGridView就好了;最后一列是我希望用户单击以提交对行的更改的按钮。
我能够轻松找到哪些行很脏,但是,我很难找到脏行中哪些单元本身很脏。
我遍历脏行中的每个单元格,但它们没有显示为脏。
任何想法都赞赏!
if ( this.inventoryGridView.Columns[e.ColumnIndex].Name == "itemCheckedIn" )
{
// Give the user a visual indicator the cells are "locked"/readonly by changing the background color
this.inventoryGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGray;
// Check if any changes have been made to the row that was checked in
if ( this.inventoryGridView.IsCurrentRowDirty )
{
foreach ( DataGridViewCell dirtyBoy in this.inventoryGridView.CurrentRow.Cells )
{
// Is he dirty?
}
}
// No changes were made to the row that was check in; let's log the check in
else
{
// Log the check in time
}
答案 0 :(得分:0)
你可以试试这个: