removing items from a combobox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I wanted to know if it is possible to remove the items that are in a combobox. I only want to remove those items that are in an array that i have

E.g if my combobox contains





and my array contains




I want the values 2 and 4 removed. Is this possible
If it is poss how do i go about doin this

Thank u
 
ComboBox.Items.Remove(Index) or CombBox.Items.RemoveAt(Index)
Bhavna said:
Hi I wanted to know if it is possible to remove the items that are in a
combobox. I only want to remove those items that are in an array that i
have.
 
Hi william

The code u provided me will remove the item for a specifed index right
The problem is i will not know this exact value.
What i was confused on is how to compare the items in the combobox with the values stored in the array. I need it to somehow loop through comparing the combobox and array to only remove items from the combobox that are also in the array. Those that are in the combobox and not in the array should not be removed

thx
 
Bhavna:

The first thing that comes to mind is using a HashTable (but there's
probably a easier name). Use the names as the Key's and then you can find
the Value (which will be the index). Also, you can bind to a HashTable
since it implements IList.
Bhavna said:
Hi william,

The code u provided me will remove the item for a specifed index right?
The problem is i will not know this exact value.
What i was confused on is how to compare the items in the combobox with
the values stored in the array. I need it to somehow loop through comparing
the combobox and array to only remove items from the combobox that are also
in the array. Those that are in the combobox and not in the array should not
be removed.
 
Back
Top