Rempel PhD
New member
- Joined
- Sep 14, 2024
- Messages
- 2
- Points
- 1
Hi guys,
Anyone can help me to populate treeview using dictionary please!here is the code i used:
private void BuildLocationTree()
{
foreach (Country country in Locationclass.locations)
{
TreeNode node = this.locationTreeView.Nodes.Add(country.name);
if (this.treeViewConf.ContainsKey(country.name))
{
node.Checked = true;
}
foreach (City city in country.citylist)
{
TreeNode node2 = node.Nodes.Add(city.name);
if (this.treeViewConf.ContainsKey(city.name))
{
node2.Checked = true;
}
}
}
}
private Dictionary<string, string> treeViewConf = new Dictionary<string, string>();
Anyone can help me to populate treeview using dictionary please!here is the code i used:
private void BuildLocationTree()
{
foreach (Country country in Locationclass.locations)
{
TreeNode node = this.locationTreeView.Nodes.Add(country.name);
if (this.treeViewConf.ContainsKey(country.name))
{
node.Checked = true;
}
foreach (City city in country.citylist)
{
TreeNode node2 = node.Nodes.Add(city.name);
if (this.treeViewConf.ContainsKey(city.name))
{
node2.Checked = true;
}
}
}
}
private Dictionary<string, string> treeViewConf = new Dictionary<string, string>();