Hi,
Can anyone direct me to sample code or explain how to implement a List Control that shows the content of a CDaoRecordset.
It also needs to allow the user to sort the records by clicking on the apropriate header.
Thanks,
Eli Vingot
Printable View
Hi,
Can anyone direct me to sample code or explain how to implement a List Control that shows the content of a CDaoRecordset.
It also needs to allow the user to sort the records by clicking on the apropriate header.
Thanks,
Eli Vingot
In the InitDialog() function of your dialog class that contains the listbox, fill the listbox with what is in the recordset. I do this with a work thread, but I will now show it how to do it without a thread and if you cannot do it with thread I will send you the code. Here is the simple way:
BOOL CMyDialog::InitInstance()
{
CListBox* list = (CListBox*)GetDlgItem(IDC_LIST1);
CMyDaoRecordSet set;
set.Open();
while(!set.IsEOF())
{
list->AddString(set.m_FirstField);
set.MoveNext();
}
set.Close();
list = 0;
}
There is a sample at codeguru:
http://www.codeguru.com/advancedui/gfxlist.shtml
That sample is rather complex, I programmed an own CListControl thats working on ODBC, but thats not well documented and not tested with DAO. If youre interested, let me know !
regards, Marco
I have some code that uses CListCtrlEx- a class I found here at Codeguru to show and manipulate the contents of a CDaoRecordset. If you are interested I could email you the sources. Let me know.
-dan