Solved

ListView control problem

Posted on 1998-01-20
2
471 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
Comment Utility
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
Comment Utility
by the way you wrong number of args to ListView_SetItemText
but it worked thanx a lot
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now