How to clear all the options in a select box in C# (Windo开发者_JAVA百科ws form application)? Is there something easy or does the code need to loop over all the items?
How to dynamically add an option to this select box?
call the Clear()
method on the Items
Property
listControl.Items.Clear();
This will work for a ListBox or a ComboBox
http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.aspx
If it's a Windows Forms ListBox control you can use ListBox.Items.Clear()
精彩评论