It's not a problem to do what you want except one thing. Once you select one node in a TreeView, you cannot have "No Nodes Selected", because some node will always be selected. So, my suggestion will be is to create a Root Node. Any way here is the code for the array. First you would have to create a variable (array) on general declaration of the Form. Then use this code on Node_Click event.
Complete Code:
Code:Option Explicit Private m_arrNodes() As String Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node) Dim iIndex As Integer Dim i As Integer ReDim m_arrNodes(i) If Node.Children Then m_arrNodes(i) = Node.Child.Text iIndex = Node.Child.FirstSibling.Index Do Until iIndex > Node.Child.LastSibling.Index If iIndex <> TreeView1.Nodes(iIndex).LastSibling.Index Then i = i + 1 ReDim Preserve m_arrNodes(i) m_arrNodes(i) = TreeView1.Nodes(iIndex).Next.Text iIndex = TreeView1.Nodes(iIndex).Next.Index Else iIndex = iIndex + 1 End If Loop End If End Sub
arrNodes will have Children of the currently selected node.
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-22-1999).]




Reply With Quote