[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

ListView control problem

Can anyone tell me how to insert text into a report listview control i've used this code with little success i'm only getting text in the first column, my listView control consists of 3 columns what am i doing wrong????
thanks a lot.


char *mYtext[] = {"this","is a", "Test"};
 for(i=0;i<3;i++)
         {
          lvi.iItem = i;
          lvi.iSubItem=i;
          lvi.pszText =mYtext[i];
          lvi.cchTextMax=100;
          lvi.iImage=i;
          lvi.lParam=0;
          ListView_InsertItem(GetDlgItem(hwnd,LISTVIEW),&lvi);

         }

0
mwebster
Asked:
mwebster
1 Solution
 
tflaiCommented:
Try this:

char *mYtext[] = {"this","is a", "Test"};
lvi.mask = LVIF_TEXT | LVIF_IMAGE;
lvi.iItem = 0;
lvi.isubItem = 0;
lvi.pszText = mYtext[0];
lvi.iImage = 0;l
ListView_InsertItem(GetDlgItem(hwnd,LISTVIEW), &lvi);
ListView_SetItemText(GetDlgItem(hwnd,LISTVIEW), 1,                                    mYtext[1]);
ListView_SetItemText(GetDlgItem(hwnd,LISTVIEW), 2,
                                   mYtext[2]);
0
 
mwebsterAuthor Commented:
by the way you wrong number of args to ListView_SetItemText
but it worked thanx a lot
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now