T
Tim Geiges
I have created a treeview for my app that on MainFormLoad I have it get
the list of drives with GetLogicalDrives() and populate the tree, then
when I click the drive it adds the first level of folders on that
drive, then click a folder and it adds the next level of folders under
the first, and so on. That part works perfectly with one flaw.
but here is the flaw:
When I add the next sub node it adds the entire path to the Node.Text
the problem is when I strip the first part of the path to display
correctly
the method does not know the rest of the path to get the directories
for the next level is, becuse the method for click basically says
treeView1.Click call GetDirectories(treeView1.SelectedNode.Text) so it
knows to get the directories from the path as in the .Text, but with
the whole path is not there it cannot get the next level
C:\
'---C:\Folder1
'---C:\Folder2
' '---C:\Folder2\Subfolder1
' '---C:\Folder2\Subfolder1\Subsubfolder1
D:\
E:\
I tried doing something like
GetDirectories(treeView1.SelectedNode.Parent +
treeView1.SelectedNode.Text) this works only for the first and second
level but then returns like "Folder2Subfolder1"
So I somehow need a loop to get the parent for each node and
concatenate to the selected node, so I can get the next folder level.
Basically the goal is to have a normal looking explorer like window
that does not have to populate the entire treeview recursively before
being used.
I am quite new to c#(only PHP before this) so any code examples would
be appreciated.
Thank you,
Tim Geiges
the list of drives with GetLogicalDrives() and populate the tree, then
when I click the drive it adds the first level of folders on that
drive, then click a folder and it adds the next level of folders under
the first, and so on. That part works perfectly with one flaw.
but here is the flaw:
When I add the next sub node it adds the entire path to the Node.Text
the problem is when I strip the first part of the path to display
correctly
the method does not know the rest of the path to get the directories
for the next level is, becuse the method for click basically says
treeView1.Click call GetDirectories(treeView1.SelectedNode.Text) so it
knows to get the directories from the path as in the .Text, but with
the whole path is not there it cannot get the next level
C:\
'---C:\Folder1
'---C:\Folder2
' '---C:\Folder2\Subfolder1
' '---C:\Folder2\Subfolder1\Subsubfolder1
D:\
E:\
I tried doing something like
GetDirectories(treeView1.SelectedNode.Parent +
treeView1.SelectedNode.Text) this works only for the first and second
level but then returns like "Folder2Subfolder1"
So I somehow need a loop to get the parent for each node and
concatenate to the selected node, so I can get the next folder level.
Basically the goal is to have a normal looking explorer like window
that does not have to populate the entire treeview recursively before
being used.
I am quite new to c#(only PHP before this) so any code examples would
be appreciated.
Thank you,
Tim Geiges