Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC
I am having problems populating the list control with data when I using report view. I can create the column headings and they show up properly. If I insert items, they do not show up, however, if I query them from software they are there. When I retrieve the count, they proper amount shows up?
 
Any ideas?
Posted 4-Feb-13 7:03am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to do an UpdateData(TRUE) after making changes to the control to get it to display.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The reason could be the view type you selected may be 'ReportView' if you choose your view as report, you need to add columns to the ListControl first. You can do this programmatically using Insert Column[^] or by design time.
 
Try adding the columns and check your screen.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I have done that. Still no data on display.
 
Code snippet:
  // adjust the list control
  m_listTest.SetExtendedStyle( LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES );
  CHeaderCtrl* pHeader = m_listTest.GetHeaderCtrl( );
  HDITEM hdiItem;
  hdiItem.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
  hdiItem.cxy = 150;
  hdiItem.fmt = HDF_STRING | HDF_LEFT;
  hdiItem.pszText = _T( "Microprocessor" );
  pHeader->InsertItem( 0, &hdiItem );
  
  CString strTemp;
  for ( int i = 0; i < 50; i++ )
  {
    strTemp.Format( _T( "Test: %d" ), i );
    m_listTest.InsertItem( i, strTemp );
    m_listTest.SetItemText( i, 0, strTemp );
  }
 
  UpdateData( true );
 
Everything indicates that are 50 items in the list, the scroll bar on the left updates and getting any of the items returns the right text, just nothing shows up in the control.
  Permalink  
v2
Comments
jibesh at 4-Feb-13 14:47pm
   
Please use the Have a Question or Comment widget to post your comments so that author who post the solution gets a notification and can reply to your message. If you post your comment as a solution, least chance you get a reply for your query. Please delete this comments and move this to your question using 'Improve Question' link under your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 576
1 OriginalGriff 183
2 Tadit Dash 170
3 Sergey Alexandrovich Kryukov 156
4 Peter Leow 130
0 Sergey Alexandrovich Kryukov 9,325
1 OriginalGriff 5,473
2 Peter Leow 4,150
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 4 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid