How to: Hide a Column in ListView
Posted on 2002-06-23
I am using several ListViews to display records. The last column of each LV contains the record number of each record but are not displayed in the header, which is set to 0 width and has no text. This is convenient since when the user sorts a column the record numbers follow each row for later retrieval.
The problem is that the column header is still there, though not obvious, and can be manipulated by the user, what’s worse is that the headers don’t size properly. I am now using an API call with an LVSCW_AUTOSIZE_USEHEADER option, not sure if that’s the best choice, since I can either leave off the last header or include it neither of which solves the problem completely. I had been manually resizing the headers in code but this doesn’t prevent users from accessing the column either and it’s sloppy.
So in short - I need to hide the last column from the user and allow the remaining column headers to align to the width of the LV without impeding current functionality.
I’m using VB6 SP5