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

            }

 

上一篇:使用kbmMW SmartBind经验几则


下一篇:ScrollView 嵌套 ListView 时,刷新页面时,会出现 自动 滚动至listview 的区域 解决方案: