DataGridView.NotifyCurrentCellDirty(Boolean) メソッド

定義

現在のセルにコミットされていない変更があることを DataGridView に通知します。

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)

パラメーター

dirty
Boolean

true セルにコミットされていない変更があることを示す場合。それ以外の場合は false

次のコード例は、カスタム セル シナリオでのこのメソッドの使用を示しています。 この例では、DateTimePicker クラスから派生したIDataGridViewEditingControl実装は、OnValueChanged メソッドをオーバーライドし、NotifyCurrentCellDirty メソッドを使用して、DataGridView コントロールへの変更を示します。

この例は、「方法: Windows フォーム 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

注釈

このメソッドを使用すると、カスタム セル型がコミットされていない変更を行ったときに DataGridView に通知できます。

適用対象

こちらもご覧ください