Solved

Edited Entity should not commit changes only when Save button is pressed

Posted on 2010-08-17
1
348 Views
Last Modified: 2012-05-10
Hello,

I have a Mainform + smallDialog.

scenario:

The Mainform has a datagrid with entities bound.

The smallDialog updates the entity double-clicked-on-the-datagrid-in-Mainform wich is passed to the smallDialog and bound there again to a bindingsource.

When I change now some data in the textfiels AND leave the textfield so the focus is lost, the data is immediate updated in the datagrid of the Mainform.

What I want is to update ONLY when the OK-button is pressed.

How can I change that update-behaviour without cloning the entity and do many workarounds?
0
Comment
Question by:MSFanboy
1 Comment
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 33465085
Hi MSFanboy;

You can use the BindingSource.SuspendBinding to cause the updating of bound fields to not take place until you enable updates with BindingSource.ResumeBinding. Please take note from Microsoft documentation :

Using SuspendBinding and prevents changes from being pushed into the data source until ResumeBinding is called, but does not actually prevent any events from occurring. Controls that use complex data binding, such as the DataGridView control, update their values based on change events such as the ListChanged event, so calling SuspendBinding will not prevent them from receiving changes to the data source. For this reason, this SuspendBinding and ResumeBinding are designed for use with simple-bound controls, such as the TextBox control. Alternatively you can use these methods in a complex binding scenario if you suppress ListChanged events by setting the RaiseListChangedEvents property to false.

Fernando
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now