hello to all good day,

BTW is there way to know what item of the bindinglist has been edited?

i came up with this problem when i create a view in mysql and a class in c# then i populate the binding list with that class, then i used it as datasource for a gridview.

now when i edit the data in the gridview for testing pupose only to see if the binding list is affected. then i iterate the bindinglist and found that the bindinglist items is modified.

now i want that data to update in the database using other methods, because the view is not updatable.

so the thing i need is, which item of the binding list has been edited so i can collect them, then update it to the database.

Is there way to do this?
if not, is there generics that i can use as a datasource?

I will appreciate for any help to come.

thank you

BTW sorry for my bad english

2 Years
Discussion Span
Last Post by ZER09

Did you check out DataGridView.IsCurrentRowDirty

"This property returns true when the pencil glyph is displayed in the row. By default, the IsCurrentRowDirty property will always equal the value of the IsCurrentCellDirty property, unless the DataGridView is bound to a data source that supports editing, or virtual mode has been implemented to use row-level commit scope. In these cases, the DataGridView will evaluate this property at the row level."

"When the user navigates away from the row, the control commits all row changes. The user can also press CTRL+ENTER to commit row changes without leaving the row. To commit row changes programmatically, call the form's Validate method. If your data source is a BindingSource, you can also call BindingSource.EndEdit."

If the view is not updatable, and you want to update the underlying tables, you should probably just query the underlying tables. Then when the data is modified, the data in the underlying tables will be modified.

Edited by cgeier


thank you for hint,

i came up creating new class impleming binding list and add some methods, but i am still wondering what is the best to implement the bindinglist<T> or IBindingList<T> or against datatable or bindingsource

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.