在listview中只选择一个项目 [英] select only one item in listview
本文介绍了在listview中只选择一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家需要帮助。如何在列表视图中仅选择一个项目并将其显示在txt框中?
如果我将FullRowSelect更改为false我不能再选择listview中的任何项目
Hi Guys need help. How can i select only one item in the listview and display it on the txt box?
If i change the FullRowSelect to false i cant no longer select any items in my listview
推荐答案
您好,请检查MultiSelect
属性ListView
control。
将此属性设置为 False 为您的ListView
control。
有关更多信息,请访问以下链接:ListView类 - MSDN [ ^ ]。
查看
属性设置为详细信息并且ListView包含多个列时,> FullRowSelect 属性非常有用。
我希望这会对你有所帮助。 :)
Hi, CheckMultiSelect
property ofListView
control.
Set this property to False for yourListView
control.
For more information check this link : ListView Class - MSDN[^].
FullRowSelect
property is useful when you set ListViewView
property to Details and your ListView contains multiple columns.
I hope this will help you. :)
从您的评论我不相信解决方案1会帮助您。
ListViewHitTestInfo [ ^ ]类应该给你你想要的东西。
例如:
From your comment I don't believe that Solution 1 will help you.
The ListViewHitTestInfo[^] class should give you what you want.
For example:
Private Sub ListView1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick
Dim lvi As ListViewHitTestInfo = ListView1.HitTest(e.X, e.Y)
'I've used a message box - you can show a form
MessageBox.Show(lvi.SubItem.Text)
End Sub
警告 - 你应该做一些检查以确保SubItem不为空等等。
Warning - you should do some checks to make sure that the SubItem is not null, etc.
这篇关于在listview中只选择一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文