點擊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;

            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM