Solved

Why does setting ComboBox's Datasource fire BeginEdit?

Posted on 2010-09-10
1
661 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
[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 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

696 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