Why isn't 'SelectedIndex' defined on this ListView?

前端 未结 2 354
遥遥无期
遥遥无期 2020-12-21 11:34

I have created a ListView called listUsers, but for some reason SelectedIndex isn\'t defined.

相关标签:
2条回答
  • 2020-12-21 12:13

    There is no selected index property on ListView in winforms. To get the selected index you can use

    listView1.SelectedIndices[0];
    
    0 讨论(0)
  • 2020-12-21 12:30

    For getting the index of a row in ListView I'm using

     int myindex = Listview1.FocusedItem.Index; 
    

    It works.

    0 讨论(0)
提交回复
热议问题