Solved

How to: Hide a Column in ListView

Posted on 2002-06-23
6
1,381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 51

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 51

Expert Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…

749 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