473,385 Members | 1,843 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,385 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 9259

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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?

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.