MVas
asked on
Treeview select/selected property
Hi Experts,
I am using vb.net 2005 framework2, there is a treeview in my program, what I would like to do is
click on a button and then a specific node is selected, click on a different button and a different node is selected.
I did some searching on ee but found questions relating to the selected property of the treeview which
i cannot find, i did find a select property but it doesnt allow to select nodes,
any help
would be appreciated.
thank you.
I am using vb.net 2005 framework2, there is a treeview in my program, what I would like to do is
click on a button and then a specific node is selected, click on a different button and a different node is selected.
I did some searching on ee but found questions relating to the selected property of the treeview which
i cannot find, i did find a select property but it doesnt allow to select nodes,
any help
would be appreciated.
thank you.
TreeView1.SelectedNode = x 'with x is the node that you want to select
ASKER
hi maidinhtai
I tried the code you posted as follows:
treeview1.SelectedNode = 0 'It threw the following error
Value of type 'Integer' cannot be converted to 'System.Windows.Forms.Tree Node'.
I then tried
Dim mynode As New System.Windows.Forms.TreeN ode
mynode.Index = 0
treeview1.SelectedNode = mynode
this won't build because property "Index" is read-only
can you help me finding what "x" needs to be in your example.
I tried the code you posted as follows:
treeview1.SelectedNode = 0 'It threw the following error
Value of type 'Integer' cannot be converted to 'System.Windows.Forms.Tree
I then tried
Dim mynode As New System.Windows.Forms.TreeN
mynode.Index = 0
treeview1.SelectedNode = mynode
this won't build because property "Index" is read-only
can you help me finding what "x" needs to be in your example.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried your examlpe above and it works like a charm,
thank you maidinhtai
thank you maidinhtai