我目前有一个绑定到从 XML 文件读取的 DataSet 的 DataGridView。
填充 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
}