Solved

How to: Hide a Column in ListView

Posted on 2002-06-23
6
1,376 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
Comment Utility
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
Comment Utility
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 49

Expert Comment

by:Ryan Chong
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:syntel
Comment Utility
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
Comment Utility
That should do the trick though more info on managing column headers would be helpful.

Thanks!
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
syntel, is me deserve points?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now