windows C# - 如何清除 ListBox 的值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6477564/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:11:37 来源:igfitidea点击:
C# - How to clear a ListBox's values
提问by Mike
How is it possible to clear a ListBox's values, e.g.
如何清除 ListBox 的值,例如
private void clearvalues_Click(object sender, EventArgs e)
{
<Wipe ListBox1 Values>
}
回答by Thomas Levesque
I assume you're using WinForms
我假设您使用的是 WinForms
listBox.Items.Clear();
回答by Bibhu
Use this:
用这个:
listBox.Items.Clear();
回答by user3259669
Try This One
试试这个
ListBox1.ClearSelection();