Form has one Combobox and one ListBox. When the \"Add\" button is clicked, I want to add the selected item from the ComboBox to the ListBox.
public partial c
The listbox didn't detect that you have changed the DataSource
. It will only refresh when Datasource
has changed, so set DataSource
to null first:
listBox1.DataSource = null;
listBox1.DataSource = data;
You could also clear the items then set the DataSource again:
listBox1.Items.Clear();
listBox1.DataSource = data;