Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:43:06+00:00 2026-06-08T15:43:06+00:00

I want to insert some items to my ListCtrl. This is my Code. I

  • 0

I want to insert some items to my ListCtrl. This is my Code. I can’t seem to get errors in the program. Unfortunately, not All items show in List, I can’t know why it is. Please help me.

    LVITEM lItem;

    lItem.mask=LVIF_TEXT;
    lItem.iItem = 1 + (nColNum - 1) * 3;
    lItem.iSubItem=0;
    lItem.pszText = W2T(L"");
    pDlgSportNews->m_List.InsertItem( 1 + (nColNum-1 ) * 3 , lItem.pszText);

    WCHAR szzText[MAX_PATH];

    lItem.iItem = 1 + (nColNum - 1) * 3;
    lItem.iSubItem = 1;
    lItem.pszText = W2T(m_arData[nColNum - 1].szGameName);
    pDlgSportNews->m_List.SetItemText(1 + (nColNum - 1) * 3 , 1 , lItem.pszText);

    lItem.mask=LVIF_TEXT;
    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 0;
    lItem.pszText = W2T(m_arData[nColNum - 1].szGameTime);
    pDlgSportNews->m_List.InsertItem(2 + + (nColNum - 1) * 3 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 1;
    lItem.pszText = W2T(m_arData[nColNum - 1].szA_Team);
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 1 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 2;
    if (m_arData[nColNum - 1].bFT_HDP)
    {
        swprintf(szzText , L"%s   %s" , m_arData[nColNum - 1].szFT_HDP , m_arData[nColNum - 1].szFT_A_HDP);
        lItem.pszText = W2T(szzText);
    }
    else
        lItem.pszText = W2T(m_arData[nColNum - 1].szFT_A_HDP);
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 2 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 3;
    swprintf(szzText , L"%s   %s" , m_arData[nColNum - 1].szFT_UO , m_arData[nColNum - 1].szFT_A_UO);
    lItem.pszText=W2T(szzText);
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 3 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 4;
    lItem.pszText = W2T(m_arData[nColNum - 1].szFT_S_Odd);
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 4 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 5;
    if (m_arData[nColNum - 1].bHT_HDP)
    {
        swprintf(szzText , L"%s   %s" , m_arData[nColNum - 1].szHT_HDP , m_arData[nColNum - 1].szHT_A_HDP);
        lItem.pszText=W2T(szzText);
    }
    else
        lItem.pszText = W2T(m_arData[nColNum - 1].szHT_A_HDP);      
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 5 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 6;
    swprintf(szzText , L"%s   %s" , m_arData[nColNum - 1].szHT_UO , m_arData[nColNum - 1].szHT_A_UO);
    lItem.pszText=W2T(szzText);
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 6 , lItem.pszText);

    lItem.iItem = 2 + (nColNum - 1) * 3;
    lItem.iSubItem = 7;
    lItem.pszText = W2T(m_arData[nColNum - 1].szHT_S_Odd);
    pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 7 , lItem.pszText);

    lItem.pszText = W2T(L" ");
    pDlgSportNews->m_List.InsertItem( 3 + (nColNum-1 ) * 3 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 1;
    lItem.pszText = W2T(m_arData[nColNum - 1].szB_Team);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 1 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 2;
    if (!m_arData[nColNum - 1].bFT_HDP)
    {
        swprintf(szzText , L"%s   %s" , m_arData[nColNum - 1].szFT_HDP , m_arData[nColNum - 1].szFT_B_HDP);
        lItem.pszText=W2T(szzText);
    }
    else
        lItem.pszText = W2T(m_arData[nColNum - 1].szFT_A_HDP);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 2 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 3;
    lItem.pszText = W2T(m_arData[nColNum - 1].szFT_B_UO);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 3 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 4;
    lItem.pszText = W2T(m_arData[nColNum - 1].szFT_D_Odd);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 4 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 5;
    if (!m_arData[nColNum - 1].bHT_HDP)
    {
        swprintf(szzText , L"%s   %s" , m_arData[nColNum - 1].szHT_HDP , m_arData[nColNum - 1].szHT_B_HDP);
        lItem.pszText=W2T(szzText);
    }
    else
        lItem.pszText = W2T(m_arData[nColNum - 1].szHT_B_HDP);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 5 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 6;
    lItem.pszText = W2T(m_arData[nColNum - 1].szHT_B_UO);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 6 , lItem.pszText);

    lItem.iItem = 3 + (nColNum - 1) * 3;
    lItem.iSubItem = 7;
    lItem.pszText = W2T(m_arData[nColNum - 1].szHT_D_Odd);
    pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 7 , lItem.pszText);

    pDlgSportNews->m_List.UpdateData();

    UpdateData(FALSE);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:43:09+00:00Added an answer on June 8, 2026 at 3:43 pm

    Possibly going out on a limb here, but:

    lItem.iItem = 1 + (nColNum - 1) * 3;

    Why are you calculating the item number this way? This could likely be a reason not all of your items are being added.

    Boilerplate for adding an item to a CListCtrl:

    // First item  (first row)
    VITEM item;
    item.mask = LVIF_TEXT;
    item.pszText = "Column Text";
    item.iItem = 0;      // Item number
    item.iSubItem = 0;         // Sub item number (column number)
    m_CListCtrl.InsertItem(&item);
    
    // Second item (second row)
    //...
    item.iItem = 1;
    //...
    

    As somebody suggested, you should use a loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to insert some items to mysql db. When I did it in
I have some data enclosed in HTML tags. I want to insert this data
Hi all I have list of type string with some items. i want to
I want to insert some items into the database. In the main activity, I
I want to insert some phrases to MySQL the first field is english and
After creating a table (by migration), I want to insert some entries directly. How
I want to insert and delete some chars in the middle of a file.
here is myproblem, i want to make a php function to insert some random
I want to insert the following as the value for a variable in some
Use case: I've just entered insert mode, and typed some text. Now I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.