开发者

I want to clear one item in listbox winforms c#

开发者_开发问答

I want to clear one item in a listbox winforms c#.

How can I get the index of the item?


ListBox has a property called SelectedIndex. To remove current selected item you have just to call RemoveAt(int) method.

Example:

int selectedIndex = myListBox.SelectedIndex;
if(selectedIndex >=0)
   myListBox.Items.RemoveAt(selectedIndex);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜