Hello, I have a WinForm in Visual Studio C# that contains a TreeView and also a DataGridView.
I am testing with a file directory path as data and populating each with the DirectoryInfo Class, which allows me to get all directors and all files within a directory.
I am able to populate both accurately, each representing the content of the file path that I've indicated ( i.e. string path = "E:\\"; ), which is a USB drive containing Folders and Files.
My question is as follows.... I would like to be able to select (to click on) a TreeNode node and that would automatically select a Row in the DataGridView corresponding to that file in the path. I would also be great if I could do that in reverse. That being, select a Row in the DataGridView and have the TreeView highlight its corresponding node (or file).
In essence, what I am trying to do is LINK the two data container structures together.
Is there a way to do that...?
Would I have needed to first create an Array and dump the entire file path of "E:\" into that Array, and then populate each of my containers, those being the TreeView and the DataGridView?
Is there a practical way to do what I'm trying to do and if so, how should I approach this task? It would seem that there has to be a way, but I'm just not clear on how to approach this.
Thank you in advance for your help.