在ListView中查找项目 [英] Finding Items in ListView
问题描述
嘿,有人知道如何根据文字在列表视图中查找项目吗?不能
似乎让IndexOf方法正常工作。
使用SendMessage API的LVM_FINDITEM方法在.Net中工作吗?
嗨迈克,
我没试过或者曾经用过它,但是你试过这个吗?
\\\
dim i as integer = DirectCast(ListView1,IList).IndexOf("")
///
Cor
Cor,
*" Cor" < no*@non.com> scripsit:我没有尝试过或曾经使用它,但你是否尝试过这个
\\\
dim i as integer = DirectCast(ListView1,IList) .IndexOf("")
///
这不会起作用,因为''ListView''没有实现'' 'IList''
界面,但您可能想尝试投射''ListView.Items''(这是一个
''ListView.ListViewItemCollection''并实现IList界面。
-
Herfried K. Wagner [MVP]
< http: //www.mvps.org/dotnet>
我没有检查它,因为我知道Ilist正在实施Listview但确实没有检查
如何。
检查后我认为你是对的。
这样就是\\\
dim i as integer = DirectCast(ListView1.items, IList).IndexOf("")
///
我正在快速回答
Cor
*Cor < no*@non.com> scripsit:我没有尝试过或曾经使用它,但你是否尝试过这个
\\\
dim i as integer = DirectCast(ListView1,IList) .IndexOf("")
///
这不会起作用,因为''ListView''没有实现''IList''
接口,但您可能想尝试强制转换''ListView.Items''(这是一个'ListView.ListViewItemCollection''并实现''IList''接口)。
Hey anyone knows how to find an item in a list view based on text ? Cant
seem to get the IndexOf method working.
would the LVM_FINDITEM method using SendMessage API work in .Net ?
Hi Mike,
I did not try it or ever used it, but did you try this
\\\
dim i as integer = DirectCast(ListView1, IList).IndexOf("")
///
Cor
Cor,
* "Cor" <no*@non.com> scripsit:I did not try it or ever used it, but did you try this
\\\
dim i as integer = DirectCast(ListView1, IList).IndexOf("")
///
This won''t work because ''ListView'' doesn''t implement the ''IList''
interface, but you may want to try to cast ''ListView.Items'' (which is an
''ListView.ListViewItemCollection'' and implements the ''IList'' interface).
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
I did not check it, because I knew Ilist was implementing Listview but did
not check how.
After checking it I think you are right.
So that will be\\\
dim i as integer = DirectCast(ListView1.items, IList).IndexOf("")
///
I am answering to fast now
Cor
* "Cor" <no*@non.com> scripsit:I did not try it or ever used it, but did you try this
\\\
dim i as integer = DirectCast(ListView1, IList).IndexOf("")
///
This won''t work because ''ListView'' doesn''t implement the ''IList''
interface, but you may want to try to cast ''ListView.Items'' (which is an
''ListView.ListViewItemCollection'' and implements the ''IList'' interface).
这篇关于在ListView中查找项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!