help me understand this code

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts Page 1 of 1
Contributors
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

help me understand this code
XTechVB
i have this code (NOT MINE)
Code: Select all
   Public Sub SubFoldersRecursive(ByVal Root As DirectoryInfo, ByRef Status As String)
        Try
            Status += Root.FullName + vbNewLine
            If (Root.GetDirectories.Length <= 0) Then
                Exit Sub
            End If
            Dim SD As DirectoryInfo
            For Each SD In Root.GetDirectories
                If SD.Attributes = FileAttributes.Directory Then
                    SubFoldersRecursive(SD, Status)
                End If
            Next
        Catch ex As Exception
            Status += ex.Message + vbNewLine
        End Try
    End Sub
to display a list of folders and subfolders

and i call that sub with the following code by using a background worker
Code: Select all
Dim T As String = ""
                    Dim R As New DirectoryInfo("D:\")
                    Call SubFoldersRecursive(R, T)
dim g as new listview item
g.text = t
listview1.items.add(g)
now the problem is that when i start the worker it duplicates all the items in the listview

my question: WHY dunnno;
You can find me on Facebook or on Skype mihai_92b
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: help me understand this code
XTechVB
never mind
Solved!
You can find me on Facebook or on Skype mihai_92b
2 posts Page 1 of 1
Return to “Coding Help & Support”