开发者

C# clear selectbox and build it dynamically - Windows form application

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜