Menu
Home
Forums
New posts
Search forums
What's new
New posts
New media
New media comments
New profile posts
Latest activity
Media
New media
New comments
Search media
Members
Current visitors
New profile posts
Search profile posts
Account Upgrades
Advertise
Marketplace
Money
PerfectMoney
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Home
Forums
Programming & Web Design
Programming
C, C++, C#
Have issue to populate treeview using dictionary!?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Rempel PhD" data-source="post: 16853" data-attributes="member: 6916"><p>Hi guys,</p><p></p><p>Anyone can help me to populate treeview using dictionary please!here is the code i used:</p><p>private void BuildLocationTree()</p><p>{</p><p>foreach (Country country in Locationclass.locations)</p><p>{</p><p>TreeNode node = this.locationTreeView.Nodes.Add(country.name);</p><p>if (this.treeViewConf.ContainsKey(country.name))</p><p>{</p><p>node.Checked = true;</p><p>}</p><p>foreach (City city in country.citylist)</p><p>{</p><p>TreeNode node2 = node.Nodes.Add(city.name);</p><p>if (this.treeViewConf.ContainsKey(city.name))</p><p>{</p><p>node2.Checked = true;</p><p>}</p><p>}</p><p>}</p><p>}</p><p></p><p>private Dictionary<string, string> treeViewConf = new Dictionary<string, string>();</p></blockquote><p></p>
[QUOTE="Rempel PhD, post: 16853, member: 6916"] 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>(); [/QUOTE]
Name
Verification
Post reply
Home
Forums
Programming & Web Design
Programming
C, C++, C#
Have issue to populate treeview using dictionary!?
Top