Are you clearing out the tree when you fresh it, or just updating the
existing nodes without removing them?
If you clear the nodes from the tree, then the selected node no longer
exists and therefore you cannot expand it. In this case you will need a path
to follow up the tree to the root, then once the tree is refreshed, you will
need to follow this path back down from the root to find the node that should
be selected and then select and expand it. Determining how you will find a
path to follow is dependent on the data stored in the tree and how it is
If you are just refreshing the existing nodes, create a TreeNode reference
and set it equal to the TreeView.SelectedNode before refreshing, then once
refreshed use the TreeNode.Expand() method from the reference you made.
private void BeginRefreshTreeView()
TreeNode selected = TreeView.SelectedNode();
private void RefreshTreeView()
//Do your refresh (make sure not to remove the nodes though)
If this doesn't help, please post an example of what is stored in the tree
and how you are refreshing it.