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 Bar107 reputationPosted Sep 30, 2009, 6:43 AM EDT
What happens if you don't set the SelectedNode at all?
TreeView shouldn't select any node unless it is specifically selected
Nir
Eyal Lewin18 reputationPosted Sep 30, 2009, 6:45 AM EDT
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 Bar107 reputationPosted Sep 30, 2009, 6:54 AM EDT
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 Lewin18 reputationPosted Sep 30, 2009, 7:08 AM EDT
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 Bar107 reputationPosted Sep 30, 2009, 7:43 AM EDT
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