鼠標單擊或者雙擊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; }