DataGridView.NotifyCurrentCellDirty(Boolean) Méthode

Définition

Signale au DataGridView que la cellule active comporte des modifications non validées.

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)

Paramètres

dirty
Boolean

true pour indiquer que la cellule comporte des modifications non validées ; sinon, false.

Exemples

L’exemple de code suivant illustre l’utilisation de cette méthode dans un scénario de cellule personnalisée. Dans l’exemple, une IDataGridViewEditingControl implémentation dérivée de la DateTimePicker classe remplace la OnValueChanged méthode et utilise la NotifyCurrentCellDirty méthode pour indiquer une modification apportée au DataGridView contrôle.

Cet exemple fait partie d’un exemple plus large présenté dans 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

Remarques

Cette méthode peut être utilisée pour autoriser les types de cellules personnalisés à notifier le DataGridView lorsqu’ils ont des modifications non validées.

S’applique à

Voir aussi