Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2007

Tip: Looking for answers? Try searching our database.

BindingSource determine changes before calling EndEdit()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Dob - 29 Mar 2007 03:53 GMT
How do I determine if there are any rows within the BindingSource that have
changed prior to calling the EndEdit().  I need to do this in order to
archive some records and if I call the EndEdit() then it also wipes out the
orginal version of the dataset record with the proposed changes.,  However I
don't wish to iterate through every row in the dataset in order to figure
out changes,  Does the BindingSource not have something similar to the
GetChanges() or HasChanges()

Thanks  in advance.
RobinS - 29 Mar 2007 04:25 GMT
EndEdit does not wipe out the original version of the data in the dataset.
I think it pushes it from the control into the underlying dataset, which is
what you want, so you can look for teh differences. (If I'm wrong, I'm sure
someone will correct me.)

In a dataset, to see the rows that have changed, you can check the version
of the data using the DataViewRowState enumeration.

This shows the rows modified, with the new value:

DataViewRowState dvrs;
dvrs = DataViewRowState.ModifiedCurrent;
Console.WriteLine("Modified Rows");
//first param is filter, 2nd is sort, 3rd is recordstates
foreach (DataRow row in dt.Select("", "", dvrs))
 Console.WriteLine("  {0}", row["CompanyName", DataRowVersion.Original]);

(I may have messed up my parentheses and square brackets there; I converted
this from a VB sample that I have.)

Robin S.
----------------------------------
> How do I determine if there are any rows within the BindingSource that
> have changed prior to calling the EndEdit().  I need to do this in order
[quoted text clipped - 5 lines]
>
> Thanks  in advance.
Marc Gravell - 29 Mar 2007 05:16 GMT
Dealing strictly with a BindingSource (and no specific implementations
such as DataSet) then perhaps monitor the ListChanged event,
specifically for ItemChanged types, and keep track of which entities
have been tweaked? To save on the complexities of tracking their
offsets during complex changes / resets, I'd just track the actual
object reference (rather than offsets at the time of the change).

Just a thought.

Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.