How do i get the SelectedItem or SelectedIndex of ListView in vb.net

前端 未结 7 1903
闹比i
闹比i 2020-12-10 13:04

As you know by question that what I want. I was using listbox. In ListBox we can get selected item by a simple line of code: listbox1.SelectedItem.

相关标签:
7条回答
  • 2020-12-10 14:03
    ListView.FocusedItem.Index 
    

    or you can use foreach loop like this

    int index= -1;
    foreach (ListViewItem itm in listView1.SelectedItems)
    {
        if (itm.Selected)
        {
            index= itm.Index;
        }
    }
    
    0 讨论(0)
提交回复
热议问题