2010-09-08 110 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