Benjamin Dover

I have a DataGridView (VS 2005) and have bound it to a table.

Upon leaving the Grid I run the following code:

For Each DR As DataGridViewRow In Me.dgvFees.Rows
Console.WriteLine(DR.Cells("FeeValue").Value & " " & dgvFees.IsCurrentRowDirty.ToString)

If dgvFees.IsCurrentRowDirty = True Then
Return True
Else
ChangesDone = False
End If
Next

Return ChangesDone

I have made changes on the grid to a few cells, but the IsCurrentRowDirty is False

Sometimes it works and sometimes it doesn't. Why isn't it consistant

Thanks



Re: Windows Forms Data Controls and Databinding IsCurrentRowDirty not always returning true

Rong-Chun Zhang - MSFT

Hi Benjamin Dover,

The IsCurrentRowDirty property indicates whether the current row has uncommitted changes, and this property returns true when the pencil glyph is displayed in the row. By default, the IsCurrentRowDirty property will always equal the value of the IsCurrentCellDirty property, unless the DataGridView is in virtual mode. In virtual mode, the DataGridView will evaluate this property at the row level.

Hope this helps.

Regards