|
-
Dec 12th, 2006, 10:47 AM
#1
[RESOLVED] Invisible columns in a ListView
If I want to create an invisible column in a listview, do I set its width to 0 or is there a more convenient way to do it?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Dec 12th, 2006, 12:28 PM
#2
Re: Invisible columns in a ListView
To my knowledge, that is the only way other.
-
Dec 12th, 2006, 12:55 PM
#3
Re: Invisible columns in a ListView
Its is the easiest way, setting width to zero, unless you wanted to subclass the listview and possibly cancel out the drawing of the column.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 12th, 2006, 01:01 PM
#4
Re: Invisible columns in a ListView
Since columns can still be resized you may want to look at this nice sample by Aaron Young:
Preventing certain Listview columns from sizing
-
Dec 12th, 2006, 01:05 PM
#5
Re: Invisible columns in a ListView
Yes, which was what I was referring to with subclassing the listview. Not I made a revision to his code in post #14 to support the double click autoresizing of the columns. 
Its a bit of work but if the data is being hidden for astechic reasons and not as a security method then setting the column width to zero is allot easier and not overkill for that use.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 12th, 2006, 03:21 PM
#6
Re: Invisible columns in a ListView
 Originally Posted by RhinoBull
Now I've just remembered I'd seen this thread some time ago but had completely forgotten about it.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Dec 12th, 2006, 06:17 PM
#7
Re: [RESOLVED] Invisible columns in a ListView
Honestly I don't understand why would you want to create a hidden column in the ListView. I simply just use a class where I store the extra data, and tie the two using a key. Also, you can add extra data in the item's Tag property.
And if you want to use the extra column for the purpose of sorting, then why not just sort the data before you add the data in the ListView ? If you get the data from a database, this is really easy by just modifying the SELECT query, and add an ORDER BY...
-
Dec 12th, 2006, 06:25 PM
#8
Re: [RESOLVED] Invisible columns in a ListView
Because by setting a flag you can display a columns data depending on the users level of permissions. No extra work switching between the two.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 12th, 2006, 09:11 PM
#9
Re: [RESOLVED] Invisible columns in a ListView
 Originally Posted by CVMichael
... this is really easy by just modifying the SELECT query, and add an ORDER BY...
Controls like Listview are not always populated from the recordset so hidden columns are quite useful and serve lots of different purposes.
-
Dec 13th, 2006, 04:09 AM
#10
Re: [RESOLVED] Invisible columns in a ListView
 Originally Posted by CVMichael
Honestly I don't understand why would you want to create a hidden column in the ListView.
A sudden idea I had but then I realized it was stupid.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Dec 13th, 2006, 09:14 AM
#11
Re: [RESOLVED] Invisible columns in a ListView
 Originally Posted by krtxmrtz
A sudden idea I had but then I realized it was stupid.
I don't think it was (if it makes feel any better about yourself)...
It's a matter of necessity I guess but technic is widely used and under sicumstances it could be the most robust solution.
-
Dec 13th, 2006, 10:35 AM
#12
Re: [RESOLVED] Invisible columns in a ListView
 Originally Posted by RhinoBull
I don't think it was (if it makes feel any better about yourself)...
Thanks for your encouraging comment.
What I meant was, using a hidden column wasn't any good for my specific purpose but I only realized that after I'd started the thread. Namely, I had numbers in one of the columns representing the relative errors resulting from the comparison of experimental measurements with theoretical calculations. These errors were spread around 0 but could be positive or negative. I was interested in sorting the column from lowest to highest values but then I could have -10 as a smaller error than say 0.7, which made no sense. So I thought I had to sort according to the absolute values and so, eureka! I'd place those in a hidden column, but then I couldn't click on the header if I didn't see it, so finally I placed the absolute values of the errors in a visible column.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Dec 13th, 2006, 10:42 AM
#13
Re: [RESOLVED] Invisible columns in a ListView
Well, as I said if it is a "necessity" and for you I guess it isn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|