473,320 Members | 2,088 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,320 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 9234

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:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.