ComboBox Binding Problem - Does Not Leave Focus

After browsing several forum sites I found so many programmers having problem with ComboBox after they bind it to a DataSet.

The problem actually is not cause by a bug or the like. The error is caused by design. Here’s the following question on the internet that I found that will explain this error further:

http://thedailyreviewer.com/dotnet/view/data-bound-combobox-does-not-leave-focus-106127786

http://www.daniweb.com/forums/thread279721.html

Both programmers encounter this problem and unable to move the focus from the said ComboBox.

Here’s an example of the data bound ComboBox.

ComboBox Data Bound Items

As you can see the properties are set correctly. But if you move the Status field from a DataSet to your windows form the ComboBox is bound by default using a Text property as shown below.

ComboBox Text Properties

In this case all you have to do is set the Text property to “(none)”. See screenshot below for the correct settings.

ComboBox Text Properties 2

Comments

Submitted byAnonymous (not verified)on Tue, 05/10/2011 - 14:07

Thanks a lot for sharing this important point. I was stuck in the same scenario and was not able to think any reason for it. After reading this post i checked the Text property and it was already none. But i was till facing the issue.After Looking again at the property grid i noticed that i had values set for SelectedItem property in the grid. I cleared it to 'None' and it solved the problem. Therefore i would say, if setting Text property to none doesn't help, set all properties here to none, and it will solve this issue. -Ajay.
Submitted byAnonymous (not verified)on Thu, 02/07/2013 - 06:05

This is solve my problems. I would like to send you a beer :) Regards

Add new comment