Rank: Member Groups: Member
Joined: 10/22/2009 Posts: 13
|
I have to fill a treeview with multiple level. I want to show all the continents, then the countries in the continents, the states in the coutry, the cities in the country and finally the population. Something like: America USA Texas Dallas 1.5m Houston 4.5m Canada Ontario Toronto 3.5m Brazil South Sao Paolo 5.8m Africa Morocco ...
I've tried : TreeView1.Nodes.Add("America"); TreeView1.Nodes[0].ChildNodes.Add("USA");
So far so good, But when I tried to add a State, that where my problem started
Any help will be appreciated
Thanks Real
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,200
|
Hi,
You just do TreeView1.Nodes[0].ChildNodes[0].ChildNodes.Add("Texas");
If you need to add city, you would do TreeView1.Nodes[0].ChildNodes[0].ChildNodes[0].ChildNodes.Add("Houston");
You basically just keep repeating ChildNodes.
Thanks
|