Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Threading

I ported this from C# To VB .net

Delegate Function AddToTreeView(node As TreeNode) As Integer

Private Sub ListDirectories()
Dim directoryList As ArrayList = Me.fileSystem.GetDirectories()

Dim ds As DirectoryStructure
For Each ds In directoryList
If ds.fileList.Count > 0 Then
Dim folder As New TreeNode(ds.di.Name.ToString())

Dim fi As FileInfo
For Each fi In ds.fileList
Dim file As New TreeNode(fi.FullName)
folder.Nodes.Add(file)
Next fi

'Vahe Karamian - 03/01/2005 - This is for Thread Safety
If treeView.InvokeRequired = True Then
' check if we running within the same thread
treeView.Invoke(New AddToTreeView(treeView.Nodes.Add), New Object() {folder})
Else
treeView.Nodes.Add(folder)
End If
End If
Next ds
Me.fileSystem = Nothing
End Sub 'ListDirectories
I have read your VB .net threading sample and cant seem to figure out the addressof part for the treeview.invoke any help would be gratly appreciated.
Sign In or Register to comment.