DataGridView - IsCurrentRowDirty

B

Bill Yanaire

Using VB.NET 2005, Windows Form and I bind a DataGridView to a table

dgvFees.DataSource = tbl


I make some changes to the cells in the grid and when I leave the grid, I
run the following code:

For Each DR As DataGridViewRow In Me.dgvFees.Rows
If dgvFees.IsCurrentRowDirty = True Then
ChangesDone = True
Else
ChangesDone = False
End If
Next



Sometimes it works and sometimes it doesn't. I can't pinpoint why it does.
I have debugged and there is no rhyme or reason as to why it isn't always
true when changes are made.

If anyone could give me some pointers, I would appreciate it.

Thank you.
 
C

Cor Ligthert [MVP]

Bill,

Ever watched where the cursor is as you run your test. In other words, did
it leave the tested field after the change or not?

Cor
 
B

Bill Yanaire

Yes, I made changes to some cells and then clicked on another control, the
code I posted ran. It just doesn't set the IsCurrentRowDirty to true. I
did step through the loop for each record and it was always false.
 
C

Cor Ligthert [MVP]

Bill,

The isDirty is a strange kind of property in dotNet (it is more used by Java
and Unix AFAIK), we mostly use Haschanges on the datasource.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top