|
-
Dec 31st, 2007, 10:58 AM
#1
Thread Starter
Frenzied Member
-
Dec 31st, 2007, 12:02 PM
#2
Lively Member
Re: Remove Multiple TreeView Nodes
Try something like:
vb Code:
Private Sub DeleteByTitle (ByRef tvwTreeView as TreeView, ByVal pstrTitle as String, ByVal pnodParentNode as TreeNode) Dim nodChild as TreeNode For Each nodChild in pnodParent.ChildNodes If nodChild.Text.toUpper() = pstrTitle.toUpper() Then tvwTreeView.Nodes.Remove(nodChild) Else If nodChild.ChildNodes.Count > 0 Then DeleteByTitle(tvwTreeView, pstrTitle, nodChild End If Next nodChild End Sub Private Sub DeleteByURL (ByRef tvwTreeView as TreeView, ByVal pstrURL as String, ByVal pnodParentNode as TreeNode) Dim nodChild as TreeNode For Each nodChild in pnodParent.ChildNodes If nodChild.Tag.toUpper() = pstrURL.toUpper() Then tvwTreeView.Nodes.Remove(nodChild) Else If nodChild.ChildNodes.Count > 0 Then DeleteByURL(tvwTreeView, pstrURL, nodChild End If Next nodChild End Sub ''''''''''''''''' Code Behind Menu '''''''''''''''' Dim nodRootNode as TreeNode For each nodRootNode in tvwHistory.Nodes DeleteByTitle (tvwHistory, tvwHistory.SelectedItem.Text.Trim(), nodRootNode) Next nodRootNode etc...
I haven't tested this, but it should get you started in the right direction.
• That's the way things come clear. All of a sudden. And then you realize how obvious they've been all along.
- Madeleine L'Engle
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|