Click here to Skip to main content
15,920,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to hide columns in lisview
and also how to get rows value
Posted

1 solution

C#
 You can hide it by setting the column width to 0. For example, if the ID is bound to the 2nd column:

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        listView1.Columns[1].Width = 0;
        listView1.ColumnWidthChanging += listView1_ColumnWidthChanging;
    }

    private void listView1_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) {
        if (e.ColumnIndex == 1) {
            e.NewWidth = 0;
            e.Cancel = true;
        }
    }
}


and try this link
http://social.msdn.microsoft.com/Forums/en-US/b50a404a-ae4c-4cb2-92a0-db159aeba767/how-does-one-hide-a-listview-column?forum=vblanguage[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900