.NET Listview Refresh

后端 未结 3 1234
攒了一身酷
攒了一身酷 2021-01-13 02:41

I have the following code, which basically takes values from a database and populates a listview.

using (IDataReader reader = cmd.ExecuteReader())
{                  


        
3条回答
  •  走了就别回头了
    2021-01-13 03:21

    Like this:

    try
    {
        lvwMyList.BeginUpdate();
        //bla bla bla
    
    }
    finally
    {
        lvwMyList.EndUpdate();
    }
    

    Make sure that you invoke lvwMyList.Items.Clear() after BeginUpdate if you want to clear the list before filling it.

提交回复
热议问题