我在vb.net中编程。 它使用Thread来做一些工作。 我现在的问题是,我有一个包含一些数据的Listview,一些产品需要来自这个Listview的东西,特别是来自子项目。
现在我的问题是,如何以Threadsafe方式从Listview获取数据? 我试过这个
Delegate Sub d_getitem(ByVal lst As ListView, ByVal index As Integer, ByVal subitemid As Integer)
Function getitem(ByVal lst As ListView, ByVal index As Integer, ByVal subitemid As Integer)
Return lst.Items(index).SubItems(subitemid).Text
End Function
然后通过
调用Dim old = ListView1.Invoke(New d_getitem(AddressOf getitem), ListView1, id, 10)
但它总是什么都不返回 任何人都可以帮助我:)。
问题已解决
只需将委托类型更改为功能;)
答案 0 :(得分:0)
问题已解决
只需将委托类型更改为功能;)