DataGridView.IsCurrentCellDirty (Propiedad)
Ensamblado: System.Windows.Forms (en system.windows.forms.dll)
Si el control DataGridView no está enlazado a datos, se confirma la edición de una celda cuando el usuario pase a otra celda.
Si los encabezados de fila son visibles, se mostrará un glifo del lápiz en el encabezado de la fila que contiene una celda con cambios no confirmados.
Si IsCurrentCellDirty es true y la celda actual aloja un control de edición, puede recuperarlo mediante la propiedad EditingControl.
En el ejemplo de código siguiente se utiliza la propiedad IsCurrentCellDirty para determinar si se confirmará un valor de celda y se provocará el evento CellValueChanged desde un controlador del evento CurrentCellDirtyStateChanged. Este ejemplo de código forma parte de un ejemplo más extenso que se proporciona en Cómo: Deshabilitar botones en una columna de botones del control DataGridView de formularios Windows Forms.
// This event handler manually raises the CellValueChanged event // by calling the CommitEdit method. void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e) { if (dataGridView1.IsCurrentCellDirty) { dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit); } } // If a check box cell is clicked, this event handler disables // or enables the button in the same row as the clicked cell. public void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "CheckBoxes") { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridView1. Rows[e.RowIndex].Cells["Buttons"]; DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1. Rows[e.RowIndex].Cells["CheckBoxes"]; buttonCell.Enabled = !(Boolean)checkCell.Value; dataGridView1.Invalidate(); } }