Home > Software engineering >  Consult: in c # comboBox, how to delete the specified item
Consult: in c # comboBox, how to delete the specified item

Time:09-21

For a great god
In c # comboBox, have been added to the following items:
1
2
3
4
5
6
7
8
9
10
Now want to get two random number, 2 and 4, for example, how to delete the two in the comboBox,

CodePudding user response:

https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.combobox.objectcollection.remove? View=netframework - 4.7.2
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.combobox.objectcollection.removeat? View=netframework - 4.7.2






CodePudding user response:

CodePudding user response:

The two number is random, so don't know the comboBox index, cannot use RemoveAt grammar,

CodePudding user response:

public void Remove (object value)
{
The RemoveAt (IndexOf (value));
}

CodePudding user response:

If the insert is AddString (2) use the Remove are removed (2), if the AddString (" 2 ") is the Remove (" 2 "), Remove the parameter is the AddString () parameters
  • Related