How do i link a Treeview and a listveiw (like windows explorer for windows 95)

12padams

Well-known member
Joined
Feb 19, 2010
Messages
48
Programming Experience
Beginner
basically I am making a game in visual basic and I need to make a windows 95 operating system as part of it...

I Ok basically I'm up to windows explorer which is proving to be extremely hard.
windows95explorerexampl.png


above is what it looks like in windows 95 and when you click an item in a treeview all the items currently in that folder in tree view appear in the list view...

How can I do something exactly like this for my operating system.

P.S I don't want to use the inbuilt "explorer" thing that comes with visual basic 2008.
 
hey... forget helping me with my original question...

my question now is how to get this to work:

I want to to be able to get all the child node names and add them to the listveiw...

VB.NET:
 Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        ListView1.Items.Clear()
        Dim childamount As TreeNodeCollection
        childamount = TreeView1.SelectedNode.Nodes
        ListView1.Items.Add(childamount.Count)
        Dim selnode As TreeNode
        selnode = TreeView1.SelectedNode
        For Each node As TreeNode In selnode.Nodes
            TreeView1.SelectedNode = TreeView1.SelectedNode.NextNode
            ListView1.Items.Add(TreeView1.SelectedNode.Text)
        Next


    End Sub

The getting the child amount works... it displays the number of childnodes in the selected node but i can't get the text of each child node to appear in the listview it comes up with an error: "Object reference not set to an instance of an object."

Can anyone plaease help with with this ??? !!!!
 
Last edited:
Got it working :)

For Each TreeNode In TreeView1.SelectedNode.Nodes
ListView1.Items.Add(TreeNode.text)
Next
 
Back
Top