Results 1 to 4 of 4

Thread: DataGridView Not Assuming All Changes

  1. #1

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    DataGridView Not Assuming All Changes

    Hi
    I have a problem with a form that has 4 datagridviews, every datagridview has is own datasource (datatables), the user can change everything in the datagrids, at any point the user can select SAVE and all the datasources are updated (table adapters with my own sp's), or that was what was supposed to happen...

    After some tests i noticed that some cells doesn't are saved....

    For example i have several combos in the datagrids, the UI shows the value that the user selected, but when saving it assumes the original value or nothing... Kind of the value wasn't committed by the control, but this happens in normal text cells...

    Before saving i call the end edit for each datagrid, and select another control in the form just to ensure that none of the datagrids are selected.

    What i'm missing here?

    I recall reading somewhere that the rows in the datagridview can have a intermediary state... but i don't know where i read that....

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  2. #2
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: DataGridView Not Assuming All Changes

    Hi,

    I know that you have said that you have called EndEdit on the DataGridView but I am not sure if that has the same affect as calling EndEdit on the BindingSource which Ensures that all pending changes are flushed to the underlying DataSource in the project. Have a look here:-

    BindingSource.EndEdit Method

    Hope that helps.

    Cheers,

    Ian

  3. #3

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: DataGridView Not Assuming All Changes

    I dont use any binding source...

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  4. #4
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    Re: DataGridView Not Assuming All Changes

    Hi,

    I would guess then that this is the potential issue.

    I would recommend adding a BindingSource between each DataTable and DataGridView and then set the DataGridView's DataSource to each BindingSource. Once done, you can then call EndEdit on each BindingSource rather than each DataGridView which I suspect will solve your intermittent issues.

    Hope that helps.

    Cheers,

    Ian

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width