By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

VB BindingSource.EndEdit() and DataTable.GetChanges()

P: 29
Hello
I have some controls (textboxs,picbox,checkbox) bind to a BindingSource. And this BindingSource.DataSource to a DataTable.

I need to know if some field has been modified in order to ask for save changes.

The problem is that when I use BindingSource.EndEdit(), the DataTable.GetChanges() always return TRUE even if none of the controls has been modified.

Any idea of what I'm doing wrong?

Thanks
Mar 30 '16 #1
Share this Question
Share on Google+
2 Replies


100+
P: 293
Perform the EndEdit on the underlying DataRowView of the BindSource Just like

DataRowView row = (DataRowView)tbl.BindSource.Current;
row.EndEdit();

Then it should work.

Please let me know if this doesn't suffice the actual requirement.
Apr 3 '16 #2

P: 29
Thanks Madankarmukta
Finally I solved this issue. All the problem was one of the controls binds to BindingSource: "PictureBox"
Don't ask me why but this control made BS.EndEdit() to 'makes changes' over the DataTable, so when I look up for changes, it always says it had changes.

So, I did this:
PictureBOX.DataBindings.Add("Image", BS, "LOGO", True, DataSourceUpdateMode.Never)

And when user changes the picture I put the new pic directly in the DataTable.

Thanks again.
Apr 4 '16 #3

Post your reply

Sign in to post your reply or Sign up for a free account.