2010-09-08 111 views
0

我使用处理的vb.net BackgroundWorker的线程,我需要定期项目添加到ListView(多列)螺纹加工过程中。vb.net - BackgroundWorker的&listview.items.add()

我可以很容易地使用下面的代码委派任务的项目添加到ListView,但我无法弄清楚如何额外的信息,以其他列在同一行。

谁能帮助我?

在线程,我会执行以下触发调用添加到列表视图:

AddListItem(ListView1, filepath) 

这里是委托代码,如果有人能告诉我如何将文本2添加到第2列我会很感激的巨大:

Delegate Sub AddListItem_Delegate(ByVal [Label] As ListView, ByVal [text] As String) 
Private Sub AddListItem(ByVal [ListView] As ListView, ByVal [text] As String, Optional ByVal [text2] As String = "") 
    If [ListView].InvokeRequired Then 
     Dim MyDelegate As New AddListItem_Delegate(AddressOf AddListItem) 
     Me.Invoke(MyDelegate, New Object() {[ListView], [text]}) 
    Else 
     ListView1.Items.Add([text]) 
    End If 
End Sub 

回答

0

创建ListViewItem小号明确如图here了所有必要的子项,并使用ListViewItemCollection.Add超负荷接受ListViewItem作为参数。

+0

这让我在正确的轨道上,谢谢! – Joe 2010-09-08 10:00:28