C# wince 嵌入式设备编程 如何获取listview里面选中的item SelectItems[0]不好使

求大神指教啊
2024-12-19 00:27:59
推荐回答(2个)
回答1:

//选中行的索引
int index = listview.SelectedIndices[0];
//选中行的值
ListViewItem selecteditem =listview.Items[index];
//选中行的第一列的值
string onetext = listview.Items[index].SubItems[1].Text;

回答2:

            if (listView1.SelectedIndices.Count > 0)
            {
                ListViewItem selecteditem = listView1.Items[listView1.SelectedIndices[0]];
            }