我怎样获得listview列表中当前选中项(只能单选,多选的属性我没设为true)的标题
if (this.listView1.Items.Count>0)//只能判断listview中是否有列表
{

  if (this.listView1.SelectedIndices.Count == 1)//只能判断listview中是否选中了列表中的一项
  {


  }
}
我怎样获得listview中当前选中列表中项的标题内容(或标题名称),代码应该怎写
就象delphi中 listview1.selected.text的内容

解决方案 »

  1.   

    string strText="";
    if(listView1.SelectedItems.Count>0){
      strText=listView1.SelectedItems[0].Text;
    }
      

  2.   

    http://community.csdn.net/Expert/topic/4322/4322157.xml?temp=.8850824
      

  3.   

    不行啊,我的项目是智能设备应用程序,listview没有SelectedItems属性,只有SelectedIndices属性,SelectedIndices后面没有text属性,也没有index属性,我是想实现自动判断点的是列表中的哪一项,并得到项的标题内容,我光知道在delphi很容易,用listview1.selected.text就可以得到内容,但在c#中怎样写啊,急死了,求各位大哥大姐能帮帮忙
      

  4.   

    SelectedIndices 属性包含所有当前选定项的从零开始的索引。
    如果只是单选。
    listView1.Item[listView1.SelectedIndices[0]]就是选中的那一项
      

  5.   

    if (this.listView1.Items.Count>0)
    {
       string str=listView1.FocusedItem.Text.ToString();
    }
      

  6.   

    zhy0101(香蕉) ( ) 信誉:100  2005-11-24 14:57:00  得分: 0  
     
     
       SelectedIndices 属性包含所有当前选定项的从零开始的索引。
    如果只是单选。
    listView1.Item[listView1.SelectedIndices[0]]就是选中的那一项
      
     
    正解。