Click here to Skip to main content
15,894,955 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i want to pass the 5th selected column record in listview into a label, but i have encounter some erroe there...


C#
private void onUpdateClick(object sender, RoutedEventArgs e) {
    if (ScheduleListView.SelectedItems.Count > 0) {
        
        //problem here
        ListViewItem item = ScheduleListView.SelectedItem[4];
        IDlbl.Content = item.SubItems[0].Text;


    }
}
Posted
Comments
Richard MacCutchan 21-Dec-13 9:54am    
You don't tell us what the error is so we can only guess that you maybe do not have 5 items selected. Have you read http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.selecteditems(v=vs.110).aspx?
Jamie888 21-Dec-13 10:00am    
the error says "cannot implicitly convert type 'object' to System.Window.Control.ListviewItem. An......"

C#
IDlbl.Content = ScheduleListView.SelectedItems[4].Text;
 
Share this answer
 
IDlbl.Content.Add() = ScheduleListView.SelectedItems[4].Text;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900