C# Clear all items in ListView

前端 未结 12 1870
我在风中等你
我在风中等你 2020-12-03 13:39

I try to clear my listview but the clear method doesn\'t work:

myListView.Items.Clear();

This doen\'t work. When i put a breakpoint at this

12条回答
  •  -上瘾入骨i
    2020-12-03 13:44

    Don't bother with Clear(). Just do this: ListView.DataSource = null; ListView.DataBind();

    The key is the databind(); Works everytime for me.

提交回复
热议问题