Back to Devexpress

TreeListNodes.Remove(TreeListNode) Method

windowsforms-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnodes-dot-remove-x28-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnode-x29.md

latest2.4 KB
Original Source

TreeListNodes.Remove(TreeListNode) Method

Removes a specific node from the node collection.

Namespace : DevExpress.XtraTreeList.Nodes

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
public void Remove(
    TreeListNode node
)
vb
Public Sub Remove(
    node As TreeListNode
)

Parameters

NameTypeDescription
nodeTreeListNode

The node to remove from the node collection.

|

Remarks

To remove a node at a specific position you can use the TreeListNodes.RemoveAt method. It takes an integer index from the range between 0 and child node count -1.

Example

The next example removes the focused node from the Tree List. The TreeListNodes.Remove method is used for this purpose. Note that the same operation can be performed using the TreeList.DeleteNode method.

csharp
TreeListNode node = treeList1.FocusedNode;
if(node.ParentNode != null)
   node.ParentNode.Nodes.Remove(node);
else
   treeList1.Nodes.Remove(node);
vb
Dim node As TreeListNode = TreeList1.FocusedNode
If Not node.ParentNode Is Nothing Then
   node.ParentNode.Nodes.Remove(node)
Else
   TreeList1.Nodes.Remove(node)
End If

See Also

RemoveAt(Int32)

TreeListNodes Class

TreeListNodes Members

DevExpress.XtraTreeList.Nodes Namespace