I have a comboBox that is populated by an array. When one of the choices is no longer available, I'd like to remove that item from the comboBox.
I tried
if (firstClassAvailable == 0)
{
this.comboBox1.Items.Remove("First");
}
which throws this exception
System.ArgumentException: Items collection cannot be modified when the DataSource property is set.
what's the proper way to do this?
The comboBox is bound to a data source with
this.comboBox1.DataSource = flightClassAr;
where flightClassAr is a string array with just two elements, "First" and "Business"
I thought I could just declare a single string variable
ie. string myNewVariable = "Business" and execute
this.comboBox1.DataSource = myNewVariable;
but that doesn't work either.
Thanks for your time in advance.
Jim