
Expand TreeView not actually expanding
Hi Ben
I knew there'd be a better way (always is when I do stuff!!)
Thanks for your response, works a treat.
Regards,
Steve.
Quote:
> Rather than calling the Expand event itself you should be doing:
> TreeView.SelectedItem.Expanded = True
> --
> Ben Baird
> Visual Basic Thunder
> http://www.vbthunder.com
> > Hi all
> > I am having a bit of trouble calling the Expand function of the
TreeView.
> If
> > the Node is not expanded, I want to expand it. It steps through all of
the
> > Expand code but at the end the TreeView's Expanded state is still false
> and
> > if I look at it when in Break mode on the 'sKey = ...' line I can't see
> the
> > child nodes.
> > Then when I try to set the SelectedItem it tries to expand the TreeView
> > again which is causing problems :(
> > Is there something that I am doing wrong?? It's probably something small
> > that I'm missing (as always!)
> > I am calling this code from the DblClick event in a ListView.
> --------------------------------------------------------------------------
> --
> > --------------
> > If TreeView.SelectedItem.Expanded = False Then
> > Call TreeView_Expand(TreeView.SelectedItem)
> > End If
> > sKey = GetNodeKey(TreeView.SelectedItem, ListView.SelectedItem.Text)
> > Set TreeView.SelectedItem = TreeView.Nodes(sKey)
> > Call TreeView_NodeClick(TreeView.SelectedItem)
> --------------------------------------------------------------------------
> --
> > ---------------
> > Any help is appreciated,
> > Regards,
> > Steve.