Friday, August 21, 2009

BeginUpdate() and EndUpdate() when populating ListView/TreeView

Use of BeginUpdate() and EndUpdate() when populating ListView/TreeView

Often a listview control in C# needs to be populated with large amount of data (bulky operations, for example, adding 1000 items). For every item added in the Listview, the control will redraw itself, thus greatly reduce the overall performance.

However, using the two methods BeginUpdate() and EndUpdate() while performing these bulk operations gives significant advantage. A call to BeginUpdate() can be made before adding/deleting/clearing items. This will stop any paint messages being sent or processed. Once the operation is done, the EndUpdate() can then be called.


I have logged the time taken of the above code (i.e. adding 1000 items in a ListView for each button click) with and without the BeginUpdate/EndUpdate method calls using a test application.


The use BeginUpdate() and EndUpdate populates the control with a constant duration and much better performance. Amazing, isn't it?

16 comments:

martymbayer said...

美女遊戲,情色a片,成人遊戲,上班族聊天室,巨乳,成人論壇,嘟嘟貼圖區,美女寫真,ut聊天室,同志聊天室,色情小遊戲,貼圖區,哈比寬頻成人,嘟嘟成人,玩美女人,視訊交友,自拍貼圖,正妹計時器,919sex成人網,免費a片觀看,jp成人,正妹牆,聊天室,ut聊天室,視訊聊天室,情色,微風成人,豆豆聊天室,視訊美女,85cc成人片,85cc成人片觀看,交友戀愛進行室,嘟嘟成人網,成人,色情,美女,色情小說,情色貼圖,情色小說,交友覓戀會館,情色文學,

GarthStich said...

0401遊戲線上0401免費視訊聊天室0401免費視訊聊天室成人成人聊天室成人成人交友影音視訊視訊聊天影音視訊美女聊天聊天交友視訊聊天交友視訊聊天網0204貼圖免費色情電影視訊聊天網0204免費下載一夜情666成人光碟

qqq said...

愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。.........................

七爺芭怡 said...

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull, Some have weird names , and all are different colors, but they all have to live in the same box.............................................

身材維持 said...

pleasure to find such a good artical! please keep update!! ........................................

驚訝 said...

Give a fool enough rope and he will hang himself. ........................................

婉婷婉婷 said...

If you can not be kind, at least have the decency to be vague.............................................

婉菁婉菁婉菁 said...

良言一句三冬暖,惡語傷人六月寒。......................................................

DexterSeibe2178 said...

你的文章讓我有種特別的感覺,請加油哦~~........................................

倫惟 said...

Hello,這裡真是百看不厭的部落格.........................

吳wyat031tskiles8 said...

以簡單的行為愉悅他人的心靈,勝過千人低頭禱告。........................................

佩春 said...

好問才能博學。

皮皮 said...

噴泉的高度,不會超過它的源頭。一個人的事業也是如此,它的成就絕不會超過自己的信念。.............................................

M12aeganT_Moe12 said...

85cc成人免費觀看 免費視訊影片 情色視訊聊天 免費av18影片 豆豆聊天交友論壇 女優光碟網 免費看性感影片 做愛影片! 偷拍實錄 UT視訊聊天室 女同志愛愛影片免費 色瞇瞇情趣用品網 18禁下載 少女脫衣秀遊戲 3d免費a影城 哪裡看a片 麗的情色網站 色情成人片 桃園一夜情留言板 383影音網 完美性交 玩美情人論壇 波波遊戲美女 動漫色辣妹 人妻 人妻熟女圖片 免費視訊 live173 a片分享區 巨乳美女寫真集 85cc倉井空 微風線上觀看區 ut聊天室 777成人 小魔女貼圖 援交電話 台灣情人網dvd 全裸鋼管秀 日本av免費 洪爺影城討論區 大奶美女圖貼 sex520貼片 情色電影下載 巨乳人妻 性愛光碟 後宮電影 成人圖庫 自拍0204貼圖 性愛貼圖自拍 模特兒走光圖

730A_ngelinaRabideau0 said...

若無一番寒徹骨,焉得梅花撲鼻香。..................................................

欣怡 said...

沒有目標而生活,恰如沒有羅盤而航行 ............................................................