获取列表视图中选定行的索引 [英] Get the index of selected row in listview

查看:181
本文介绍了获取列表视图中选定行的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取列表视图中所选行的索引.

解决方案

尝试以下操作:

  Dim  x  as  整数
x = ListView1.FocusedItem.Index 



否则

  Dim 索引 As  整数 = ListView1.SelectedIndices( 0 )



否则

 int索引= 0;
如果(this.myListView.SelectedItem.Count>  0 )
index = this.myListView.SelectedIndices [ 0 ] 



否则

使用 ListView.SelectedIndex属性 [ ^ ]


 Textbox1.Text = listview1.Items.Item(listview1.FocusedItem.Index).SubItems.Item(column_number).Text 


I want to get the index of the selected row in the listview.

解决方案

Try this:

Dim x as Integer
x = ListView1.FocusedItem.Index



Or else

Dim index As Integer = ListView1.SelectedIndices(0)



Or else

int index = 0;
if (this.myListView.SelectedItem.Count > 0)
index = this.myListView.SelectedIndices[0]



Or else

Use ListView.SelectedIndex Property[^]


Textbox1.Text =  listview1.Items.Item(listview1.FocusedItem.Index).SubItems.Item(column_number).Text


这篇关于获取列表视图中选定行的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆