Showing posts with label How to listview control. Show all posts
Showing posts with label How to listview control. Show all posts

Friday, March 25, 2011

How to use List View Control in C#.Net

A ListView control allows you to display a list of items with an optional icon in a similar manner to Windows Explorer. The most often used manner is to show a multicolumn list of items as displayed here.
How to change listview control view:
You need to just use the view  property or listview control eg:
How to add item in Listview control
You can use the listviewitem object for adding one row in a Listview eg:

 ListViewItem lwi=new ListViewItem();
            lwi.Text = "Ajit";
            lwi.SubItems.Add("20000$");
            lwi.SubItems.Add("20-4-2011");
            listView1.Items.Add(lwi);

How to clear or remove all items from the listview control
listView1.Items.Clear();