copy or extract item from listview

  • Thread starter Thread starter a
  • Start date Start date
A

a

Hi,

I inherit my class from listview. Is it possible to copy or extract
information (ListViewItem) from the listview providing the index?

Thanks
 
The Items property on the ListView class will return a collection that
you can pass an index to (through the indexer) and will return a
ListViewItem.
 
a said:
Hi,

I inherit my class from listview. Is it possible to copy or extract
information (ListViewItem) from the listview providing the index?

Thanks
private void listView1_SelectedIndexChanged(object sender, System.EventArgs
e)
{
ListView.SelectedListViewItemCollection contents =
this.listView1.SelectedItems;

if(contents.Count>0)
label1.Text = contents[0].SubItems[1].Text;
else
label1.Text ="error";
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top