一般情况请注意别先删除了选中行,又去使用。那就会导致找不到选中行。。。。。哥犯了这个错误。。。找了很长时间问题
if (this.lstwlview.SelectedIndices.Count > 0)
{
if (MessageBox.Show("确认删除该条码?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK)
{
//获得选择的序列号
string ss = "";
if (lstwlview.SelectedIndices != null && lstwlview.SelectedIndices.Count>0)
{
ListView.SelectedIndexCollection c = lstwlview.SelectedIndices;
ss = lstwlview.Items[c[1]].Text;
//ss = lstwlview.Items[c[0]].SubItems[1].Text;// 表示选中行的第二列
MessageBox.Show(ss);
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)