Detecting changes in a DataGrid

iamsuperman

New member
Joined
Aug 17, 2005
Messages
3
Hi all,

I have a DataGrid inside a Windows Form. I know that using datagrid.hasChanges will return a boolean value indicating whether changes have been made to the datagrid.

But the problem I am having is that:

this hasChanges method didnt return a boolean value of True when the user had made changes to a cell in the datagrid BUT he didnt not press "ENTER" or click on other components on the windows form to "confirm" his changes.

What I want is that, even the user did not "confirm" his changes, the changes that he had made would also be detected so that a message dialog box will pop up asking him if he wants to save his changes.

Hope you guys understand what I mean. :rolleyes:
How can I solve this problem?
Many thanks to you all. :)
 
This may not be any help to you at all, but if youre binding to a DataSet, you can also use the DataSets "HasChanges" method which might return true in your case. Where I work we have a policy of never trusting a control to give alerts on datachanges - always use the DataSet. For example, if we need to check on changes or "trigger" something (such as filtering a combo when another combo changes a value) we use the DataSets events, such as ColumnChanged or RowChanged.

Im not much help on the DataGrid so if this doesnt help, just say "No way, Jose!" and hopefully someone who knows, can help.

-nerseus
 
Nerseus said:
This may not be any help to you at all, but if youre binding to a DataSet, you can also use the DataSets "HasChanges" method which might return true in your case. Where I work we have a policy of never trusting a control to give alerts on datachanges - always use the DataSet. For example, if we need to check on changes or "trigger" something (such as filtering a combo when another combo changes a value) we use the DataSets events, such as ColumnChanged or RowChanged.

Im not much help on the DataGrid so if this doesnt help, just say "No way, Jose!" and hopefully someone who knows, can help.

-nerseus

Thank you very much for your advice! :)
I was making a mistake, I was using the dataset.hasChanges(not datagrid.hasChanges) method but it didnt return true in the situation that I mentioned.

Anyway, thanks a lot for your advice. :)
 
Back
Top