Solved

Why does setting ComboBox's Datasource fire BeginEdit?

Posted on 2010-09-10
1
654 Views
Last Modified: 2012-08-14
I have a combobox whose DataSource is set to
a List of IEditableObjects.  The idea is the user will select an item from the list to create a parent-child link.

What's happening is upon setting the DataSource, BeginEdit is called for each object in the list.  I assume this is done during creation of the BindingContext however the objects are not editable at this stage.

Not only does this unneccessarily add overhead the objects in the list remain in a permanent state of in edit mode.  I know I can manually call CancelEdit for each item in the list but shouldn't there be a simpler solution.
0
Comment
Question by:KurgerBurger
1 Comment
 
LVL 30

Accepted Solution

by:
MlandaT earned 125 total points
ID: 33652523
The IEditableObjects interface provides functionality to commit or rollback changes to an object that is used as a data source. Once you use the list of IEditableObjects as a datasource, the objects are readied for manipulation... NOTE: The object itself has no way of telling whether it is being bound to an object that supports editing or not. Once used as a DataSource, there is a possibility that the UI element being bound to allows editing. This is unfortunately standard behaviour and well... maybe just a fact of life... It does sound wasteful. The alternative is not to use the interface?
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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