How do I click on a text file in treeview to display its contents in richtextbox? There is a problem with the path, I can not understand how to connect the path and the name of the selected file. How to handle pressing the TreeView?
public string derevo_papok(string path) { TreeNode tn = new TreeNode(); treeView1.Nodes.Add("", path,2); string[] Directorii = Directory.GetDirectories(path); string[] Files = Directory.GetFiles(path); foreach (string s2 in Directorii) { string t = s2.Substring(s2.LastIndexOf('\\') + 1); ((TreeNode)treeView1.Nodes[0]).Nodes.Add(s2, t, 0); } foreach (string s3 in Files) { string r = s3.Substring(s3.LastIndexOf('\\') + 1); ((TreeNode)treeView1.Nodes[0]).Nodes.Add(s3, r, 0); } return path; } The code of the tree itself