Tag Archives: Stop Flicker

How to Stop Listbox Flicker in VB.NET

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
 

I see some persons mentioning that their .NET Listbox is flickering when they add alot of items. There is a easy work around that will stop that from happening. The ‘Listbox.BeginUpdate’ and ‘Listbox.EndUpdate’ subs should do the trick.  All you have to do is call the Listbox.BeginUpdate sub before you start adding items, and then call the Listbox.EndUpdate sub after you’ve added your items. BeginUpdate suspends the Listbox control from drawing/redrawing. So while you are adding items, calling this sub before you begin adding items will keep the listbox from showing the items until you call the EndUpdate sub. And likewise calling the EndUpdate sub will then allow the Listbox to redraw showing the items that you’ve added to it. Below is a simple example…


 

Listbox1.BeginUpdate()

Listbox1.Items.Add(“All of My Items))

Listbox1.EndUpdate

Thats all there is to it 🙂

Jason H