4
Reply

Problem getting selected item from ListView subcolumns

Moose Pickard

Moose Pickard

Oct 15 2010 5:03 AM
4k
Hi

I've got a Listview with  4 colums. I constructed the following code from examples over the net. 
When I click the button it gives me ListViewItem: {Name of the car here, the first column}.
How can I get the subitems, in my case the Owner, Type etc. 
If you can help, please use my code if possible.

By the way, the way the selected item is displayed is that the only column that gets "blue" is the first one.
How could I make the whole row "blue"?

private void RentCarButton_Click(object sender,EventArgs e) {
ListView.SelectedListViewItemCollection sel = CarsLView.SelectedItems;
	foreach (ListViewItem item in sel){
	MessageBox.Show(item.ToString());
	}
}

Thank you

Answers (4)