winform的listview,获取单击的某行内容

1、首先要在listview控件属性中,添加click事件

2、要判断是否获取了几行
int selectCount = listview1.SelectedItems.Count; //选中的行数目,listview1是控件名。
if (selectCount == 0)
  return;//没选中,不做响应

3、获取选中行的内容
string sPID = listview1.SelectedItems[0].SubItems[1].Text;//第2列
string sWXH = listview1.SelectedItems[0].Text;//第1列:微信号

原文链接:https://blog.csdn.net/u014385680/article/details/80884926

posted @ 2020-06-22 10:51  向前追起  阅读(1059)  评论(0编辑  收藏  举报