DataGridView.NotifyCurrentCellDirty(Boolean) Método

Definição

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

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 comprometidas; caso contrário, false.

Exemplos

O exemplo de código seguinte ilustra a utilização deste método num cenário de célula personalizada. No exemplo, uma IDataGridViewEditingControl implementação derivada da DateTimePicker classe sobrepõe o OnValueChanged método e usa o NotifyCurrentCellDirty método para indicar uma alteração ao DataGridView controlo.

Este exemplo faz parte de um exemplo mais amplo 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

Observações

Este método pode ser usado para permitir que tipos de células personalizados notifiquem quando DataGridView têm alterações não comprometidas.

Aplica-se a

Ver também