CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Guest

    LisrCtrl Containing a DaoRecordSet

    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


  2. #2
    Join Date
    Apr 1999
    Posts
    306

    Re: LisrCtrl Containing a DaoRecordSet

    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;
    }


  3. #3
    Join Date
    May 1999
    Location
    Piacenza, ITALIA
    Posts
    30

    Re: LisrCtrl Containing a DaoRecordSet

    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


  4. #4
    Join Date
    Apr 1999
    Location
    VA
    Posts
    7

    Re: LisrCtrl Containing a DaoRecordSet

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured