I have three treeViews that have the same data loaded to them when a form is loaded. I can write the data in three different functions, but that seems like duplicating a lot of work. How can I load each treeView with the same data. So far I have tried the following and it does not work correctly. SecondRowNodes is a set of nodes I have loaded earlier in the function.
//this one misloads the first two and loads treeView4 correctly
TreeNode topNodes = new TreeNode(currentDataSet.HousingAreaTable[housingAreaCounter].HousingAreaName, secondRowNodes);
treeView2.Nodes.Add(topNodes);
treeView3.Nodes.Add(topNodes);
treeView4.Nodes.Add(topNodes);
//this one has the same effect as before and loads the first two wrong and treeView4 correctly
TreeNode topNodes = new TreeNode(currentDataSet.HousingAreaTable[housingAreaCounter].HousingAreaName, secondRowNodes);
TreeNode topNodes2 = new TreeNode(currentDataSet.HousingAreaTable[housingAreaCounter].HousingAreaName, secondRowNodes);
TreeNode topNodes3 = new TreeNode(currentDataSet.HousingAreaTable[housingAreaCounter].HousingAreaName, secondRowNodes);
treeView2.Nodes.Add(topNodes);
treeView3.Nodes.Add(topNodes2);
treeView3.Nodes.Add(topNodes3);