keeping a treeview from expanding

I have a treeview that has three parent nodes, each having a multiple child nodes. I'm selecting various child nodes (single select), adding it's corresponding data, via ADO, to a listview, then removing the selected treeview node.

My question is this. Once I've started to make my selections from a group of child nodes, I need to somehow keep the user from changing the parent nodes (thus, keeping the user from mixing data). Is there a way to disable the treeview's ability to expand & collapse nodes using the count method of my listview?

Thanks,
Mark
[601 byte] By [VTTW] at [2007-11-18 2:14:47]
# 1 Re: keeping a treeview from expanding
Hi

One solution would be to have an object declared at the top of your form:

Private mobjParentNode As Node

In the event where the parent node is selected set it:

e.g.

Private Sub tvwTreeView_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

Dim objNode As Node

Set objNode = tvwTreeView.HitTest(x, y)

If objNode Is Nothing Then

Exit Sub

End If

Set mobjParentNode = objNode

End Sub

then, when you need to, set the desired node to be the mobjParentNode:

Set tvwTreeView.SelectedItem = mobjParentNode

hope it helps
jvbd02 at 2007-11-10 0:02:30 >