Solved

Why does setting ComboBox's Datasource fire BeginEdit?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

11 Experts available now in Live!

Get 1:1 Help Now