Home All Groups Group Topic Archive Search About

Hide some columns of listview

Author
16 Mar 2006 7:56 AM
Li Pang
Hi,

I want to know how to hide a column of listview.
Thanks in advance

Author
16 Mar 2006 11:27 AM
Carlos J. Quintero [VB MVP]
You can´t really, or not easily (you should have to set the width to 0 and
prevent the user resizing it with some API calls/notifications). If you need
to hold extra data for each listitem that you don´t want to show, you can
create a class that derives from ListViewItem, add the extra property,
create instances of it, and add them to the listview.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com


Show quoteHide quote
"Li Pang" <LiP***@discussions.microsoft.com> escribió en el mensaje
news:57082078-BB04-4DB5-A688-C072073C3531@microsoft.com...
> Hi,
>
> I want to know how to hide a column of listview.
> Thanks in advance
Author
16 Mar 2006 3:08 PM
Claes Bergefall
A simpler way is to create a class/structure to hold the data and then store
instances of that class in the ListViewItem.Tag property

    /claes

Show quoteHide quote
"Carlos J. Quintero [VB MVP]" <carlosq@NOSPAMsogecable.com> wrote in message
news:uPBbOyOSGHA.4600@TK2MSFTNGP11.phx.gbl...
> You can´t really, or not easily (you should have to set the width to 0 and
> prevent the user resizing it with some API calls/notifications). If you
> need to hold extra data for each listitem that you don´t want to show, you
> can create a class that derives from ListViewItem, add the extra property,
> create instances of it, and add them to the listview.
>
> --
>
> Best regards,
>
> Carlos J. Quintero
>
> MZ-Tools: Productivity add-ins for Visual Studio
> You can code, design and document much faster:
> http://www.mztools.com
>
>
> "Li Pang" <LiP***@discussions.microsoft.com> escribió en el mensaje
> news:57082078-BB04-4DB5-A688-C072073C3531@microsoft.com...
>> Hi,
>>
>> I want to know how to hide a column of listview.
>> Thanks in advance
>
>
Author
21 Mar 2006 10:17 AM
Carlos J. Quintero [VB MVP]
Hi Claes,

I don´t like to store things in the Tag property because it is not clear
what that bag can contain since it is declared as Object and if you have to
declare a separate class anyway to hold the data (more than one value) it is
better to use inheritance, IMO.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com


Show quoteHide quote
"Claes Bergefall" <claes.bergefall@nospam.nospam> escribió en el mensaje
news:e2hBEtQSGHA.1572@tk2msftngp13.phx.gbl...
>A simpler way is to create a class/structure to hold the data and then
>store instances of that class in the ListViewItem.Tag property
>
>    /claes