I am using a listview (listView1) which is flickering when i populate data into it(adding 10 lines in every second).
How can I enable double buffer property to make it flicker free.
Please give me step by step instructions. I am new to c#.
I am using a listview (listView1) which is flickering when i populate data into it(adding 10 lines in every second).
How can I enable double buffer property to make it flicker free.
Please give me step by step instructions. I am new to c#.
At 100 lines per second, you are going to need double buffering and virtual mode.
Double buffering requires subclassing a ListView and setting the DoubleBuffered
protected property. Virtual mode requires setting VirtualSize
to the number of rows and then responding the RetrieveVirtualItem
event.
You should seriously consider using ObjectListView which is an open source wrapper around the .NET ListView that solves LOTS of problems so you don't have to.
One option here, would be to only update the listview datasource, so that your not directly accessing your control, only the underlying datasource.
DataTable dt = new DataTable();
//load the Datatable with items from your external hardware connection.
myListView.datasource = dt;
Then you only update the DataTable, not the control's list of items. With double buffering, you should see the affect you require.
Lastly, 100 listview items per second is a lot, do you need to have this many items in the listview? I would suggest filtering this list to only items you need at the time, will make it perform much better.