Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6143803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:34:05+00:00 2026-05-23T18:34:05+00:00

In my application I have a collection of data objects that define what types

  • 0

In my application I have a collection of data objects that define what types of data the application collects as it executes.

The user can open a dialog window to edit these objects and that dialog window contains DataGridView instances that are bound to the collections. This means that any changes the user makes are instantly applied, which is not good.

The other issue is that this dialog window has a Cancel button allowing the user to discard all the changes they have made since opening the window.

Currently when the window is opened I serialize all the objects (shallow copy won’t work) and if the user clicks on Cancel then I deserialize them to restore them. The problem I am running into is that this is messy. It changes all the references and some of these objects store a data history as well, which isn’t serialized. I then have to have events rippling out through the application to notify objects to update their references, etc. It’s a pain.

Is there a better approach to this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:34:06+00:00Added an answer on May 23, 2026 at 6:34 pm

    There is a better way, using an interface that is cooked into the framework – IEditable

    BeginEdit
    CancelEdit
    EndEdit

    The basic idea it that you create a snapshot of some object’s state when you call BeginEdit. On CancelEdit, you roll back to that SavedState, and on EndEdit you commit it.

    The devil is in the details of course. Here’s a popular link that has served as an implementation answer to similar SO questions for some ideas

    http://www.paulstovell.com/blog/runtime-ui-binding-behavior-ieditableobject-adapter

    Cheers,
    Berryl

    NOTE: this isn’t conceptually different to what tocco is saying, and you should give him the answer. BUT worth spelling out in a separate answer because it formalizes the concept in a .Net idiomatic way and offers more insight into a useful implementation. Besides, it is good fun saying the word idiomatic :–)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application, I have three collection objects which store data. The data which
I have written a c# win forms application that allows the user to open
We have an application that will be collecting data and storing it in local
I have created a site collection inside a web application with user A as
I have an application that contains methods that work with data using Entity Framework
I have a non document-based Core Data application. There's an NSTreeController that manages a
I have a data class that return some objects from a wcf dataservice to
I have a listbox that I'm binding to a collection of objects. In the
I'm writing a application where the user can write json-code and store that json
I have an application that takes a bunch of data and processes it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.