There is following code:
public partial class Form1 : Form
{
private List<string> names = new List<string> { "aa", "bb", "cc" };
public Form1()
{
InitializeComponent();
comboBox1.DataSource = names;
comboBox1.DisplayMember = "Name";
}
private void button1_Click(object sender, EventArgs e)
{
names.Add("dd");
}
}
When i click on the button i want to add new value to source list and expect that combobox would be instantly updated to include that value. But it's not. Why? In general, what's is the easiest proper way to connect List to a combobox the way that adding/removing items in list affects combobox directly?