protected void treeView1_BeforeExpand(object sender,System.Windows.Form.TreeViewCancelEventArg e)
{
String fullPath;
if(e.Node.Equals(treeView1.Nodes[0]))
{ fullPath="";}
else fullPath=e.Node.Text+"\\";
TreeNode tempNode =e.Node;
while(tempNode.Parent!=null&&!tempNode.Parent.Equals(treeView1.Node[0]))
{fullPath=tempNode.Parent.Text+"\\"+fullPath;
tempNode=tempNode.Parent;
}
fullPath=treeView1.Node[0].Text+fullPath;
for(int i=0;i<e.Node.Nodes.Count;i++)
{String[] dirs=null;
try
{dirs=Directory.GetDirectories(fullPath+e.Node.Nodes[i].Text);
}
catch(Exception ex)
{....}
}
{
String fullPath;
if(e.Node.Equals(treeView1.Nodes[0]))
{ fullPath="";}
else fullPath=e.Node.Text+"\\";
TreeNode tempNode =e.Node;
while(tempNode.Parent!=null&&!tempNode.Parent.Equals(treeView1.Node[0]))
{fullPath=tempNode.Parent.Text+"\\"+fullPath;
tempNode=tempNode.Parent;
}
fullPath=treeView1.Node[0].Text+fullPath;
for(int i=0;i<e.Node.Nodes.Count;i++)
{String[] dirs=null;
try
{dirs=Directory.GetDirectories(fullPath+e.Node.Nodes[i].Text);
}
catch(Exception ex)
{....}
}
{
foreach(string d in System.IO.Directory.Getfiles(dir))
{
displayfile(d); // whatever function you like;
}
foreach(string m in System.IO.Directory.GetDirectories(dir))
{
displaydir(m); // whatever
mydir(m);
}
}