+ Reply to Thread
Results 1 to 6 of 6

ListView - adding items require the column headers??

  1. #1
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    ListView - adding items require the column headers??

    I am now trying to play around with ListView control in place of ListBox control, and trying to replace all my code. I have been successful by looking online and seeing how to add rows and columns etc.

    However, in order to be successful, I have found that I need to ensure the column headers are NOT hidden when I add rows. Then later I hide the column headers after adding rows. If I hide the column headers BEFORE adding the rows, the code fails. It does really weird stuff like add the rows (column 1 values) as columns in the first row of the listview.

    Why is that? Why does adding rows not work properly unless the columnheaders are unhidden? Thanks

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: ListView - adding items require the column headers??

    You do not show your code so it's hard to say what your issue is but the headers do not need to be shown.

    You have to add columns but you do not need to show the headers.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: ListView - adding items require the column headers??

    Baffling, played with all combinations for sometime, just used the attached loading work-around.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: ListView - adding items require the column headers??

    the code is basically the same as torachan's code.

    The issue I think is with the columnheaders. They must be added, even if the hidecolumnheaders = true. If they're not added, then the bug I talked about happens.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: ListView - adding items require the column headers??

    It's not a bug. You have to add columns in order to populate the control. Displaying the column headers is optional.

  6. #6
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: ListView - adding items require the column headers??

    Okay. Thanks Andy!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Dictionary Items to Listview
    By sunjam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2018, 12:22 AM
  2. Adding Conditional If Statement to Copy Using Column Headers
    By phelbin in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-16-2016, 03:25 PM
  3. Display value of all items in Listview
    By kop1ko in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2015, 04:35 PM
  4. [SOLVED] Adding column headers to listbox
    By devatu in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-26-2015, 07:44 AM
  5. Listview items to export to excel
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2014, 04:32 AM
  6. [SOLVED] count of unique listview items
    By Kiran2012 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-08-2013, 07:43 AM
  7. [SOLVED] Printing ListView Control Items into WorkSheet
    By contaminated in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 09:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1