CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Adding a lot of data to list control

  1. #1
    Join Date
    Sep 2006

    Adding a lot of data to list control

    My project have a list control and have to add a lot of data to it(more than 1000 item) I use these code for add each item.
    void AddDataList(CListCtrl *m_list, int row,
    CString col0, CString col1, CString col2,
    CString col3, CString col4, CString col5)

    LVITEM lvi;
    lvi.mask = LVIF_TEXT;lvi.iItem=row;
    lvi.iSubItem = 0;lvi.pszText = (char*)(LPCTSTR)col0;

    lvi.iSubItem = 1;lvi.pszText = (char*)(LPCTSTR)col1;

    lvi.iSubItem = 2;lvi.pszText = (char*)(LPCTSTR)col2;

    lvi.iSubItem = 3;lvi.pszText = (char*)(LPCTSTR)col3;

    lvi.iSubItem = 4;lvi.pszText = (char*)(LPCTSTR)col4;

    lvi.iSubItem = 5;lvi.pszText = (char*)(LPCTSTR)col5;

    my problem is that
    while program is adding the item my program look like hang up,
    because the list control is updated every time when it add item.

    How can I do if I want to update it only one time when it finish adding item.

  2. #2
    Join Date
    Aug 2007
    Farnborough, Hants, UK

    Re: Adding a lot of data to list control

    Take a look at the SetRedraw() method. This can be used to prevent visual updates until you have finished adding, and then you can set the flag back again.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)