Detecting real changes in a bound datagrid

G

Guest

Hi,
I need to determine when data in a datagrid bound to a dataset has changed and thus make
updates accordingly.

I would of thought the code below would detect when a change has been made to the dataset, however
the haschanges value is set to true even if i just click on a cell without changing anything. is there anyway of
telling if anything has actually really changed on the bound grid. I need to know when an actual changes are made, not just when the
user has clicked on a cell.


thank you
David

The code:

datagrid1.datasource = customerdataset1.tables!customers


private sub datagrid1_currentcellchanged(etc....)

If customersDataSet1.HasChanges Then
MsgBox("dataset has changed")

End If

end sub
 
C

Cor

Hi David,

Add this before the check for changes

DirectCast(BindingContext(customerDataset1!customers),
CurrencyManager).EndCurrentEdit()
If customersDataSet1.HasChanges Then
MsgBox("dataset has changed")

Now that this event not fired when you leave the datagrid or close the
program.

I hope this helps?

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