Re: CListCtrl - Reload the ListControl area
To add to other replies if you just want to remove some items or modify some
items you can use DeleteItem() and SetItemText() to modify the list
dynamically. Also, if you are going to reload the list control you can call
SetRedraw(false) first then SetRedraw(true) after reloading to minimize the
reload flicker.
I often update "fields" in my lists by simply overwriting the text.
You could also use a virtual list control and then the data would simply
change as needed as it is displayed.
Tom
<aloha826@gmail.com> wrote in message
news:c124d456-c16b-40da-8267-e954a9b8c12d@t39g2000prh.googlegroups.com...
Hi,
In my dialog,
- I have some search criteria: few edits fields (let say, firstname,
lastname) and a search button
- One List Control (Report) at the bottom
Upon OnInitDialog, I will populate the List entries from database
(using CDatabase)
Now, to filter/search, I want to give user to search, and re-populate
the list (IDC_LIST1)
How to re-populate the existing list ? is it the same way like how I
populate the list during Initialization ?
Let say:
CFoo::OnBtnSearch( )
{
// get the edit field value, put in variable strFirstName /
strLastName
// CDatabase
// open the query, i.e : "SELECT * from UserTable WHERE fname like
'%" & strFirstName & "%' OR lname like '%" & strLastName & " %'
//re populate to IDC_LIST1
}
Thanks a lot.
Regards,
Kenji