ListView display issue: need to remove or hide unwanted columns from user view when listview is disp

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi All,
<p align=left>I have a ListView display of about 20 columns which comes correctly. But i want to show only columns 1,2,3,4,5 and remaining ALL the columns should be hidden or removed from the user view.
<p align=left> I have tried this following code,
<p align=left><font color="#008000" size=2><font color="#008000" size=2>for example...
</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>For</font></font> <font color="#0000ff" size=2><font color="#0000ff" size=2>Each</font></font><font size=2> col </font><font color="#0000ff" size=2><font color="#0000ff" size=2>As</font></font><font size=2> ColumnHeader </font><font color="#0000ff" size=2><font color="#0000ff" size=2>In</font></font> <font color="#0000ff" size=2><font color="#0000ff" size=2>Me</font></font><font size=2>.lvwDisplay.Columns

</font><font color="#008000" size=2><font color="#008000" size=2>            to remove all columns except first 5 columns
</font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>                 If</font></font><font size=2> col.Text = </font><font color="#a31515" size=2><font color="#a31515" size=2>"my Display Column 5"</font></font> <font color="#0000ff" size=2><font color="#0000ff" size=2>Then
                    </font></font><font color="#0000ff" size=2><font color="#0000ff" size=2>Me</font></font><font size=2>.lvwDisplay.Columns.Remove(col)
</font><font color="#0000ff" size=2><font color="#0000ff" size=2>                 End</font></font> <font color="#0000ff <font color="#0000ff <font size=2>If</font>
<blockquote dir=ltr style="margin-right:0px
<blockquote dir=ltr style="margin-right:0px </font></font>
<font size=2><font color="#0000ff <font color="#0000ff  If</font></font> col.Text = <font color="#a31515 <font color="#a31515 "my Display Column 6"</font></font> </font><font size=2><font color="#0000ff <font color="#0000ff Then
</font></font><font color="#0000ff <font color="#0000ff       Me</font></font>.lvwDisplay.Columns.Remove(col)
<font color="#0000ff <font color="#0000ff  End</font></font> <font color="#0000ff <font color="#0000ff If </font></font></font></blockquote></blockquote>
<p dir=ltr><font size=2><font color="#0000ff <font color="#0000ff                 If</font></font> col.Text = <font color="#a31515 <font color="#a31515 "my Display Column 7"</font></font> </font><font size=2><font color="#0000ff <font color="#0000ff Then
                  </font></font><font color="#0000ff <font color="#0000ff Me</font></font>.lvwDisplay.Columns.Remove(col)
<font color="#0000ff <font color="#0000ff                 End</font></font> </font><font color="#0000ff <font color="#0000ff" size=2>If
</font></font><font color="#0000ff <font color="#0000ff <font color="#008000 <font color="#008000" size=2>        etc.. upto all unwanted columns              
</font></font></font></font><font color="#0000ff <font color="#0000ff
<font size=2>Next</font>
<font color="#000000" size=2>but i know this is not good option if we have more number of columns to delete or hide.</font>
<p align=left><font size=2> <font color="#000000 I am sure some of you might have encountered this kind of an issue of Removing or Hiding columns with ListView display of multiple columns. In case if u have any idea about this, pls share here...it would be helpful.</font></font>
<p align=left><font size=2><font color="#000000 <font color="#0000ff With Regards && Thanks</font>..
sankar</font></font> </font></font><hr size="1" align="left" width="25% sankar sv

View the full article
 
Back
Top