468,544 Members | 1,759 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,544 developers. It's quick & easy.

DataGridView does not save last change even I CommitEdit; But if I click somewhere else, it saves!

I found DataGridView in .NET 2.0 has a bug, or maybe I used it in a wrong
way, just try to confirm with you guys:

I have a checkbox column in it, and a save button on the form try to save
changes made by this checkbox column.

But the state of last checkbox is always not saved, unless I click somewhere
else on the form.

//all of these line code does not help!!!!
if (this.dgvProject.IsCurrentCellInEditMode)
{
this.dgvProject.EndEdit(); //I know this will commit
}
if (this.dgvProject.IsCurrentCellDirty)
{
this.dgvProject.CommitEdit(DataGridViewDataErrorCo ntexts.Commit);
//just try again
}
this.dsPowerCapi.project.AcceptChanges();

//delete above lines, and replaced with this single line, it works, all
changes are saved!!!
this.rtbGreeting.Focus();//a fake line is needed to make
sure last change also saved


//code after ....

this.projectTableAdapter.Update(this.dsPowerCapi.p roject);

this.changed = false;
this.tsbSave.Enabled = this.changed;
Mar 25 '08 #1
0 1278

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Henok Girma | last post: by
14 posts views Thread by Anoop | last post: by
6 posts views Thread by Miro | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.