Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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. :)

  • *Experts*
Posted

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

"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
Posted
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. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...