Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Even the simplest code like this doesnt work:
  <br />
TreeView1.Nodes.Add("ali", "alii")<br />
TreeView1.Nodes.Add("veli", "velii")<br />
TreeView1.SelectedNode = TreeView1.Nodes(1)<br />

selectednode becomes nothing after this code.
The same code in c#2.0 runs without problem.
Is there a bug with treeview in vb?
Posted

I copied your code into the load event of a new form with just a TreeView control on it and it worked just fine. The form loaded with two items in the treeview and the second one (velii) was selected. When I debugged it showed that TreeView1.SelectedNode was the velii node. Perhaps some other code in your project is causing the problem? Or some property that you set on the TreeView control?
 
Share this answer
 
Thanks Kschuler,
You remembered me that I added a beforeselect condition which is not satisfied in my case.
my Best,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900