Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

listview add column

In c#, how to create the column and add the items in listview?

Say one example

0
godwindotnet
Asked:
godwindotnet
1 Solution
 
Jaime OlivaresCommented:
Please specify which kind of GUI library you are using. This will allow us to guide you to the right direction.
0
 
DhaestCommented:
Add Data to a ListView
http://www.java2s.com/Code/CSharp/GUI-Windows-Form/AddDatatoaListView.htm

Here is an article on how to use Listviews: http://www.ondotnet.com/pub/a/dotnet/2002/10/28/listview.html

and Here is the msdn documentation on the listview object and the listviewItem object. http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem.aspx

I would highly recommend that you at least take the time to skim the documentation on any objects you use from the .net framework. While the documentation can be pretty poor at some times it is still invaluable especially when you run into situations like this.

 it's simply a matter of adding subitems to a listviewitem like so:

ListViewItem i = new ListViewItem("column1");
i.SubItems.Add("column2");
i.SubItems.Add("column3");
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now