Welcome Guest Search | Active Topics | Sign In | Register

Fill treeview multiple level Options
Real Drouin
Posted: Saturday, October 31, 2009 9:54:50 AM
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
eo_support
Posted: Saturday, October 31, 2009 11:07:37 AM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.