Hi.

I implemented a listview in a program. It works great, but not perfect. I have experience problems. First, the listview insert and display new item perfectly the if it was empty before insertion. For example.

// assume listview is empty

-----
CListView &lc = GetListCtrl();

for (int i = 0; i < 10; ++i)
lc.InsertItem(0, "testing");
-----

The code above will insert ten "testing" strings into the listview control. CListView will update the window with the ten items. However, let say that I want to add more items. Here is a technique I use.

-----
CListView &lc = GetListCtrl();
lc.DeleteAllItems();

int i;
for (i = 0; i < 10; ++i)
lc.InsertItem(i, "testing");

// inserting new lines

for (int j = i; i < 20; ++j)
lc.InsertItem(j, "new items");

Okay. The code above should work. However, sometimes CListView will not display the updated data. Again, in the example above, the program will not update the window with "new items." This seems to happen when I start to add a lot of items (100 or more). Is there some kind of a limit on the CListCtrl?

What is the proper way to add, remove, and clear a CListCtrl *and* properly redraw everything correctly?

Thanks,
Kuphryn