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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LeoVBNET
    New Member
    • Apr 2013
    • 29

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

    Hello
    I have some controls (textboxs,picbo x,checkbox) bind to a BindingSource. And this BindingSource.D ataSource 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.E ndEdit(), the DataTable.GetCh anges() always return TRUE even if none of the controls has been modified.

    Any idea of what I'm doing wrong?

    Thanks
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    #2
    Perform the EndEdit on the underlying DataRowView of the BindSource Just like

    DataRowView row = (DataRowView)tb l.BindSource.Cu rrent;
    row.EndEdit();

    Then it should work.

    Please let me know if this doesn't suffice the actual requirement.

    Comment

    • LeoVBNET
      New Member
      • Apr 2013
      • 29

      #3
      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.Data Bindings.Add("I mage", BS, "LOGO", True, DataSourceUpdat eMode.Never)

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

      Thanks again.

      Comment

      Working...