点击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