'bsCustomerLanguages' is a BindingSource
? In that case it should work if you set cbLanguage.DataSource = bsCustomerLanguages
and add to bsCustomerLanguages directly
Add item to binded combobox to list
-
08-07-2023 - |
Question
I have a combobox binded to a list like this
public List<CustomerLanguage> CurrentCustomerLanguageList
{
get { return _currentCustomerLanguageList; }
set
{
_currentCustomerLanguageList = value;
bsCustomerLanguages.DataSource = Presenter.CustomerLanguageToProxy(value);
cbLanguage.DataSource = bsCustomerLanguages.DataSource;
cbLanguage.DisplayMember = "LanguageName";
cbLanguage.ValueMember = "Id";
}
}
On the form i have + - buttons which must allow to add or delete items inside combobox.
The problem is: i dont know how to add new item to binding source and the list without full refresh of combobox. Of course when i add, selected value must remains and no selectedvaluechanged event must be raised.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow