DataGridView.NotifyCurrentCellDirty(Boolean) Método

Definição

Notifica que a DataGridView célula atual tem alterações não confirmadas.

public:
 virtual void NotifyCurrentCellDirty(bool dirty);
public virtual void NotifyCurrentCellDirty(bool dirty);
abstract member NotifyCurrentCellDirty : bool -> unit
override this.NotifyCurrentCellDirty : bool -> unit
Public Overridable Sub NotifyCurrentCellDirty (dirty As Boolean)

Parâmetros

dirty
Boolean

true para indicar que a célula tem alterações não confirmadas; caso contrário, false.

Exemplos

O exemplo de código a seguir ilustra o uso desse método em um cenário de célula personalizado. No exemplo, uma implementação IDataGridViewEditingControl derivada da DateTimePicker classe substitui o OnValueChanged método e usa o NotifyCurrentCellDirty método para indicar uma alteração no DataGridView controle.

Este exemplo faz parte de um exemplo maior mostrado em How to: Host Controls in Windows Forms DataGridView Cells.

protected override void OnValueChanged(EventArgs eventargs)
{
    // Notify the DataGridView that the contents of the cell
    // have changed.
    valueChanged = true;
    this.EditingControlDataGridView.NotifyCurrentCellDirty(true);
    base.OnValueChanged(eventargs);
}
Protected Overrides Sub OnValueChanged(ByVal eventargs As EventArgs)

    ' Notify the DataGridView that the contents of the cell have changed.
    valueIsChanged = True
    Me.EditingControlDataGridView.NotifyCurrentCellDirty(True)
    MyBase.OnValueChanged(eventargs)

End Sub

Comentários

Esse método pode ser usado para permitir que tipos de célula personalizados notifiquem quando DataGridView tiverem alterações não confirmadas.

Aplica-se a

Confira também