PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Find out the changed rows in DataGridView
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Find out the changed rows in DataGridView
![]() |
Find out the changed rows in DataGridView |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I have a DataGridView. It's data source is a collection of objects (not a DB records). After the user did some changes (Add/Delete/Update) I want to find out the changed rows and the action made on them. How to do it? 10x |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Typically you will maintain this state inside of your custom objects. Add
and Update can be maintained with an internal IsNew and IsDirty flags. Delete is a bit trickier as your object will have to tell it's collection to flag it for deletion. When you are ready to persist your information, your collection then will need to have the CRUD functions to persist the objects based on their information. Create: IsNew=True Update: IsDirty and not IsNew Delete: IsDeleted (in a deleted collection inside the hosting collection?) The downside of objects is that you have to do some of the plumbing yourself. The upside is you get to do some of the plumbing yourself. Jim MCSD.Net "Moshe" <Moshe@discussions.microsoft.com> wrote in message news:6A5CBA83-C599-43AD-AFB2-855E684D269E@microsoft.com... > Hi, > > I have a DataGridView. > It's data source is a collection of objects (not a DB records). > > After the user did some changes (Add/Delete/Update) I want to find out the > changed rows and the action made on them. > > How to do it? > > > 10x > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Would it be easier if I create a DataTable from my object collection, bind it
to the DataGridView, and by that have all the "flags/state management" for free? Regards, Moshe "Jim Wooley" wrote: > Typically you will maintain this state inside of your custom objects. Add > and Update can be maintained with an internal IsNew and IsDirty flags. > Delete is a bit trickier as your object will have to tell it's collection to > flag it for deletion. When you are ready to persist your information, your > collection then will need to have the CRUD functions to persist the objects > based on their information. > > Create: IsNew=True > Update: IsDirty and not IsNew > Delete: IsDeleted (in a deleted collection inside the hosting > collection?) > > The downside of objects is that you have to do some of the plumbing > yourself. The upside is you get to do some of the plumbing yourself. > > Jim > MCSD.Net > > "Moshe" <Moshe@discussions.microsoft.com> wrote in message > news:6A5CBA83-C599-43AD-AFB2-855E684D269E@microsoft.com... > > Hi, > > > > I have a DataGridView. > > It's data source is a collection of objects (not a DB records). > > > > After the user did some changes (Add/Delete/Update) I want to find out the > > changed rows and the action made on them. > > > > How to do it? > > > > > > 10x > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

