DataGridView.IsCurrentRowDirty 属性


获取一个值,该值指示当前行是否有未提交的更改。Gets a value indicating whether the current row has uncommitted changes.

 property bool IsCurrentRowDirty { bool get(); };
public bool IsCurrentRowDirty { get; }
member this.IsCurrentRowDirty : bool
Public ReadOnly Property IsCurrentRowDirty As Boolean


如果当前行有未提交的更改,为 true;否则为 falsetrue if the current row has uncommitted changes; otherwise, false.



当行中显示铅笔标志符号时,此属性将返回 trueThis property returns true when the pencil glyph is displayed in the row. 默认情况下,IsCurrentRowDirty 属性将始终等于 @no__t 属性的值,除非 @no__t 2 绑定到支持编辑的数据源,或者已实现虚拟模式来使用行级别提交作用域。By default, the IsCurrentRowDirty property will always equal the value of the IsCurrentCellDirty property, unless the DataGridView is bound to a data source that supports editing, or virtual mode has been implemented to use row-level commit scope. 在这些情况下,DataGridView 将在行级别计算此属性。In these cases, the DataGridView will evaluate this property at the row level.

当用户离开行时,控件提交所有行更改。When the user navigates away from the row, the control commits all row changes. 用户还可以按 CTRL + ENTER 来提交行更改而无需离开该行。The user can also press CTRL+ENTER to commit row changes without leaving the row. 若要以编程方式提交行更改,请调用窗体的 Validate 方法。To commit row changes programmatically, call the form's Validate method. 如果数据源是 BindingSource,还可以调用 @no__t。If your data source is a BindingSource, you can also call BindingSource.EndEdit.