Solved

How to: Hide a Column in ListView

Posted on 2002-06-23
6
1,379 Views
Last Modified: 2008-02-01
Hi all,

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

Thanks,

Jim
0
Comment
Question by:syntel
6 Comments
 
LVL 2

Accepted Solution

by:
egsemsem earned 200 total points
ID: 7102080
Instead of using a hidden column, you can use Tag property of ListItem, example:

Dim LVitem As ListItem

Set LVitem = LV.ListItems.Add
LVitem.Text = Data1
LVitem.SubItems(1) = Data2
LVitem.Tag = ID

Osama
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7102304
Please maintain your open questions:

Marketing Software Date: 06/01/2001 02:35AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=progsoftgen&qid=20128299
Comparing two date fields in a SQL query Date: 08/01/2001 09:04AM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20161641
DateTime Picker Date: 07/29/2001 06:20PM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20159943
Importing data in text format Date: 06/08/2001 07:19AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20131975
JOIN with 3 Tables Date: 05/11/2001 12:51PM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20116893
Is there a query? Date: 06/06/2002 07:08PM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=vbdatabases&qid=20308828
Broken IE Date: 11/23/2000 12:45AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=win98&qid=11952599

Anthony
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 7102863
According to my experience, we cannot hide a column in ListView, instead we can set its Width to 0. Example:

ListView1.ColumnHeader(ColumnNumber).Width = 0

Cheers
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

Author Comment

by:syntel
ID: 7106368
acperkins:

I closed a couple of those.  A few of them are pending delete...and the admin made a note to leave them alone.
0
 

Author Comment

by:syntel
ID: 7106374
That should do the trick though more info on managing column headers would be helpful.

Thanks!
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 7109793
syntel, is me deserve points?
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ms access #TYPE! error on report when no data 4 77
Paint/Redraw window while dragging 16 78
Run code from text file in vb 1 65
VB 6 error 5 in windows 10 but not in XP 7 57
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

821 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