Hello All..
i have a TreeView called "tvwProject" which in the frmLoad function i have the following code:
//tvwProject.SelectedNode = tvwProject.TopNode;
meaning that i don't want any node to be selected in the loading of the frm.
the event's flow continues to the Enter function & automatically to AfterSelect
in the Enter event -> tvwProject.SelectedNode == null
BUT in AfterSelect event -> tvwProject.SelectedNode = first node in treeView
how can i control the selected node ??
how can i see the event flow in my program ??
thank's
Eyal
Loading
Nir BarPosted Sep 30, 2009, 11:43 AM
I did some research, and indeed it seems that the top-node is selected by default.
I think that if you check e.Action it may tell you the reason that the node got selected.
Could you check that?
Please mark this post as an answer if it helps you
Nir
Eyal LewinPosted Sep 30, 2009, 11:08 AM
my code:
private void tvwProject_AfterSelect(object sender, TreeViewEventArgs e)
{
.
.
.
if (e.Node != null)
{
get's in this if...
.
.
.
}
}
i've tried it, but in my code i refer to e.Node..
this e.Node comes == treeView.selectedNode
so it doesnt change if i put null in treeView.selectedNode, the args still comes with the selected node for some reason...
thank's
Nir BarPosted Sep 30, 2009, 10:54 AM
You simply set
treeView.SelectedNode = null;
Or, don't do anything (meaning don't set SelectedNode at all)
Please mark this post as an answer if it helps you
Nir
Eyal LewinPosted Sep 30, 2009, 10:45 AM
how can i do something like that ?
basically, this is what i want..
i want my TreeView to load without a specific selected node, but right now it doesn't happen.
thank's
Nir BarPosted Sep 30, 2009, 10:43 AM
What happens if you don't set the SelectedNode at all?
TreeView shouldn't select any node unless it is specifically selected
Nir