if ( listView1.SelectedItems.Count > 0) { // 选中行的单元值 string s1 = listView1.SelectedItems[0].SubItems[0].Text.ToString(); string s2 = listView1.SelectedItems[0].SubItems[1].Text.ToString(); // 选中第几行 int a = listView1.SelectedIndices[0]; }
if ( listView1.SelectedItems.Count > 0) { // 选中行的单元值 string s1 = listView1.SelectedItems[0].SubItems[0].Text.ToString(); string s2 = listView1.SelectedItems[0].SubItems[1].Text.ToString(); // 选中第几行 int a = listView1.SelectedIndices[0]; }