Solved

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

Posted on 2010-08-17
1
368 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 63

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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