class myTreeNode : TreeNode{ public string FilePath; public myTreeNode(string fp) { FilePath = fp; this.Text = fp.Substring(fp.LastIndexOf("\\")); }}
// You should replace the bold text file // in the sample below with a text file of your own choosing.// Note the escape character used (@) when specifying the path.treeView1.Nodes.Add(new myTreeNode (System.Environment.GetFolderPath _ (System.Environment.SpecialFolder.Personal) _ + @"\TextFile.txt") );