473,396 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ListView Can't see column headers

I am trying to populate a listview and I can not see the column headers, is
there a property I am forgetting to set?

Here is my code

// Create three items and three sets of subitems for each item.

ListViewItem item1 = new ListViewItem("item1",0);

// Place a check mark next to the item.

item1.Checked = true;

item1.SubItems.Add("1");

item1.SubItems.Add("2");

item1.SubItems.Add("3");

ListViewItem item2 = new ListViewItem("item2",1);

item2.SubItems.Add("4");

item2.SubItems.Add("5");

item2.SubItems.Add("6");

ListViewItem item3 = new ListViewItem("item3",0);

// Place a check mark next to the item.

item3.Checked = true;

item3.SubItems.Add("7");

item3.SubItems.Add("8");

item3.SubItems.Add("9");

// Create columns for the items and subitems.

listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left);

listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left);

listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left);

listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center);

//Add the items to the ListView.

listView1.Items.AddRange(new ListViewItem[]{item1,item2,item3});
Nov 16 '05 #1
2 9264

Did you set the "View" property of the ListView to "Details" instead of the default "Large Icon"?

-Mark Schmidt

----------------------------------------------------------------------?
nntp://msnews.microsoft.com/microsoft.public.dotnet.languages.csharp/
I am trying to populate a listview and I can not see the column headers, is
there a property I am forgetting to set?

Here is my code

// Create three items and three sets of subitems for each item.

ListViewItem item1 = new ListViewItem("item1",0);

// Place a check mark next to the item.

item1.Checked = true;

item1.SubItems.Add("1");

item1.SubItems.Add("2");

item1.SubItems.Add("3");

ListViewItem item2 = new ListViewItem("item2",1);

item2.SubItems.Add("4");

item2.SubItems.Add("5");

item2.SubItems.Add("6");

ListViewItem item3 = new ListViewItem("item3",0);

// Place a check mark next to the item.

item3.Checked = true;

item3.SubItems.Add("7");

item3.SubItems.Add("8");

item3.SubItems.Add("9");

// Create columns for the items and subitems.

listView1.Columns.Add("Item Column", -2, HorizontalAlignment.Left);

listView1.Columns.Add("Column 2", -2, HorizontalAlignment.Left);

listView1.Columns.Add("Column 3", -2, HorizontalAlignment.Left);

listView1.Columns.Add("Column 4", -2, HorizontalAlignment.Center);

//Add the items to the ListView.

listView1.Items.AddRange(new ListViewItem[]{item1,item2,item3});
Nov 16 '05 #2


When I change it to List I get the Item level, but when I set it to
details I see nothing.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Yaron | last post by:
Hi I'm creating a control very similar to the ListView in Details mode. I'm confused as to how to go about drawing the column headers at the top As the column headers are static and stay in one...
2
by: MFRASER | last post by:
I am trying to populate a listview and I can not see the column headers, is there a property I am forgetting to set? Here is my code // Create three items and three sets of subitems for each...
0
by: Per Rollvang | last post by:
Hi All! I use a special ListViewItemComparer-class to sort items in a listview for any column, and I have also allowed column-reordering. So far so good, but if I click the columnheader of any...
0
by: Abhishek Bagga | last post by:
I want to insert Image in the column headers of the Listview control I have been trying this but was unable to achieve it. Is it possible? if yes kindly guide me how to achieve this. -- -...
3
by: Danny Tuppeny | last post by:
Hi all, I need to build a Treeview/Listview control (none of those on codeproject do quite what I need!), and was considering using one of the existing controls as a starting point, though now...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
1
by: J L | last post by:
Is it possible to create multi-line column headers for the listview control? If so, how? TIA, John
3
by: JL | last post by:
Is it possible and if so, how, to change the color (and/or font) of a listveiw's column headers at runtime and individually? TIA, John
0
by: erik.alsmyr | last post by:
When setting the Scrollable property of a listview and resizeing it the headers will be painted wrongly. This defect is documented in MSDN as: In versions of the .NET Framework prior to version...
1
by: =?Utf-8?B?LnBhdWwu?= | last post by:
how do i change the color of the text in the fixedrow (column headers) of a listview? thanks
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.