Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2008, 04:47 AM
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by fazee4u
 Dear All,

How much columns you have in Listview only same no of SubItems will be displayed in the listview. All extra subitems will be hidden.

Example:
--------

With lvwUserQuota
       .Items.Add("Demo")
       .Items(0)SubItems.Add("Demo sub item")
       .Items(0)SubItems.Add("Demo sub hidden item-1")
       .Items(0)SubItems.Add("Demo sub hidden item-2")
       .Items(0)SubItems.Add("Demo sub hidden item-3")
End With

All "Demo sub hidden item-x" items will be hidden.

Note: listview has only two columns.

Best of luck

Fazee4u
Nothing new in here... except that he uses the other listview.

 
Old August 28th, 2008, 02:35 PM
Registered User
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

// Hide fifth column of m_listView
m_listView.Columns[4].Width = 0;


 
Old October 2nd, 2008, 03:52 PM
Registered User
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Kokeb
 // Hide fifth column of m_listView
m_listView.Columns[4].Width = 0;


Setting the column width to 0 will appear to work, but the user can resize the column, which will reveal it again. Another way to hide it is to use the Add() and Remove() methods on the Gridview.Columns collection. This does not delete the columns. First, in your XAML code, give the GridView and GridViewColumn names:

<GridView x:Name="gv">
    <GridViewColumn x:Name="gvc"...

Create a function like this to hide a column of your choice:

'Hide column
Private Sub HideColumn(ByVal Column As GridViewColumn)
   If gv.Columns.Contains(Column) = True Then
       'Remove column
       gv.Columns.Remove(Column)
   End If
End Sub

Now you can hide the column gvc using:

HideColumn(gvc)

Unhiding a column is similar. Just check if it is not in the list with "gv.Columns.Contains(Column) = False" and unhide it by using "gv.Columns.Add(Column)".

'Show column
Private Sub ShowColumn(ByVal Column As GridViewColumn)
   If gv.Columns.Contains(Column) = False Then
       'Add column
       gv.Columns.Add(Column)
   End If
End Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble hiding and unhiding columns in VBA jtmelb Excel VBA 0 February 14th, 2007 07:04 PM
Hiding Report Columns gupta_abhinav99 Crystal Reports 1 February 9th, 2007 04:38 AM
hiding / unhiding columns in datagrid drachx General .NET 9 October 18th, 2004 02:37 AM
Dynamically Hiding Columns r_ganesh76 Crystal Reports 1 September 23rd, 2004 11:18 PM
Listview columns Duncan VS.NET 2002/2003 0 April 16th, 2004 03:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.