Solved

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

Posted on 2010-08-17
1
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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