Solved

ListView control problem

Posted on 1998-01-20
2
483 Views
Last Modified: 2013-12-03
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
Comment
Question by:mwebster
2 Comments
 
LVL 4

Accepted Solution

by:
tflai earned 200 total points
ID: 1410214
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
 

Author Comment

by:mwebster
ID: 1410215
by the way you wrong number of args to ListView_SetItemText
but it worked thanx a lot
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question