ok I have some code below as an example but I can`t seem to sort this one out, I want to pass the fullpath to the directory so that when I click the node it adds the subfolder to that node at runtime
Here is my sub below I know why it`s happening but I don`t know how to fix it, many thanks in advance

Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        
        Dim Filename As String
        Dim Files As String() = Directory.GetFiles(e.Node.FullPath)

        For Each Filename In Files
            TreeView1.Nodes(e.Node.Index).Nodes.Add(Files)
        Next



    End Sub

this part TreeView1.Nodes(e.Node.Index).Nodes.Add(Files) is where my problem is
Help anyone

Hi,

You can find some explanation, here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.