iamsuperman Posted September 4, 2005 Posted September 4, 2005 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 didn't return a boolean value of True when the user had made changes to a cell in the datagrid BUT he didn't 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. :) Quote
*Experts* Nerseus Posted September 5, 2005 *Experts* Posted September 5, 2005 This may not be any help to you at all, but if you're binding to a DataSet, you can also use the DataSet's "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 DataSet's events, such as ColumnChanged or RowChanged. I'm not much help on the DataGrid so if this doesn't help, just say "No way, Jose!" and hopefully someone who knows, can help. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
iamsuperman Posted September 5, 2005 Author Posted September 5, 2005 This may not be any help to you at all, but if you're binding to a DataSet, you can also use the DataSet's "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 DataSet's events, such as ColumnChanged or RowChanged. I'm not much help on the DataGrid so if this doesn't 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 didn't return true in the situation that I mentioned. Anyway, thanks a lot for your advice. :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.