window form detail view auto save

  • Thread starter Thread starter GS
  • Start date Start date
G

GS

I Google search for answer to detected changes to the current row in detail
view of a windows form ( not datagridview), so far I have not got the right
search term to get me the answer, certainly I found lots on datagridview and
..net asp form.

Is there an easy way to detect if the current record has been changed during
row leave or somehow let me prompt user to save change or cancel edit
 
got the save partially solved. on the event rowLeave
DataRow[] dr = ieStringTmpDataSet.Regex.Select("", "",
DataViewRowState.ModifiedCurrent);
if (regexDataGridView.IsCurrentRowDirty | dr.GetUpperBound(0) >= 0){
DialogResult dlgReslt = MessageBox.Show("Save Changes?",

this.Text + " - The row has unsaved changes",
MessageBoxButtons.YesNo);

if (dlgReslt == DialogResult.Yes){

regexBindingNavigatorSaveItem.PerformClick();

setStatus("Saved change to regex " + regexNameTextBox.Text);

}else

{ //' problem with cancelling change, cancel edit does not
work

// on next row leave wihtout additonal change, I still
get prompted

// help here to cacnel the change

}

}
 
Hmm, try saving info (entering) and before exiting check as suggested,
and restore info if user want to cancel?
just thinking out loud...
//CY
 
I suppose I can save the record info during entering the record and restore
on user request not to save.

However,
1. that will add unnecessary database traffic
2. is there not a proper way to cancel edit? I have used other ide and
tools and there is definite mechanism to cancel change
 
there is something called DataRowVersion.Original or DataRowVersion.Proposed
In other word Microsoft has already designed in something for retrieving
original vs. proposed value for a databound control. that makes sense.

the problem here is finding the proper way to cancel forget proposed values
for a given row the way Microsoft designed so I don't run afoul of exception
later on.

Furthermore the method for me to detect row change is not reliable in that
tends to ignore the change on the first row leave after the change.
 
I finally after hours of Google and found the datset rejectchanges work
Something like
ieStringTmpDataSet.RejectChanges();
Still have problem with proper detect of row change though and appreciate
help.
 

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

Back
Top