Solved

ListView control problem

Posted on 1998-01-20
2
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…

738 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