In this project there are multiple reports being generated. Each report can have unlimited subreports, making this a completely recursive solution. I need to make a C# viewer to show these reports, so I made a basic prototype at the moment with a left panel of a treeview and the right panel with a textbox.
My problem is I cannot figure out a way to have the right text populate with the information from the left report (from the tree view) properly. The names of the reports can be duplicates. I was originally adding all of the information to a dictionary with the report names for the keys and the data as the values, but this was not working because of the duplicate titles…
I wanted to use some kind of unique random ID for each report to associate the treenodes with the correct report information, but I seem to be having difficulty doing this. http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.aspx
From what I have read it doesn’t seem like there is some kind of property I can use to do this…How can I make the right textbox populate the information from the report based on the selected treenode on the left side? The treenodes are being added recursively at the moment, and like I said there can be duplicates, so the names of the nodes are not necessarily unique.
Thanks, I will be happy to answer any further questions.
Use the
TreeNode.Tagproperty to store a reference to the report:Then, in the
AfterSelectevent handler, retrieve the report from theTagproperty of the selected node: