点击ListView 获取所选择行的数据
作者:互联网
鼠标单击或者双击listView 行,或者相关的行数据
if (lvUserInfo.SelectedIndices != null && lvUserInfo.SelectedIndices.Count > 0) { ListView.SelectedIndexCollection indexCollection = lvUserInfo.SelectedIndices; txtUserID.Text = lvUserInfo.Items[indexCollection[0]].Text; txtUserName.Text = lvUserInfo.Items[indexCollection[0]].SubItems[0].Text; txtHomePhone.Text = lvUserInfo.Items[indexCollection[0]].SubItems[1].Text; txtCardID.Text = lvUserInfo.Items[indexCollection[0]].SubItems[2].Text; txtPhone.Text = lvUserInfo.Items[indexCollection[0]].SubItems[3].Text; }
标签:SubItems,lvUserInfo,Text,SelectedIndices,indexCollection,获取,点击,Items,ListView 来源: https://www.cnblogs.com/wenjie0904/p/12630539.html