Back to Devexpress

TreeListNodes.Add(Object[]) Method

windowsforms-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnodes-dot-add-x28-system-dot-object-x29-9ad8bab9.md

latest3.4 KB
Original Source

TreeListNodes.Add(Object[]) Method

Adds a new child TreeListNode containing the specified values.

Namespace : DevExpress.XtraTreeList.Nodes

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
public TreeListNode Add(
    params object[] nodeData
)
vb
Public Function Add(
    ParamArray nodeData As Object()
) As TreeListNode

Parameters

NameTypeDescription
nodeDataObject[]

An array of values or a DataRow object, used to initialize the created node’s cells.

|

Returns

TypeDescription
TreeListNode

The created TreeListNode object.

|

Remarks

This method calls the TreeList.AppendNode(nodeData, ParentNode) method. The TreeListNodes.ParentNode property’s value is passed as the method’s second parameter. See the TreeList.AppendNode topic to learn more.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Add(Object[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-treelist-copy-nodes-to-another-treelist/CS/CopyNodesExample/MainForm.cs#L44

csharp
object[] values = Enumerable.Range(0, columnCount).Select(x => sourceNode.GetValue(x)).ToArray();
var newNode = targetNodes.Add(values);
newNode.Assign(sourceNode);

winforms-treelist-copy-nodes-to-another-treelist/VB/CopyNodesExample/MainForm.vb#L47

vb
Dim values As Object() = Enumerable.Range(0, columnCount).[Select](Function(x) sourceNode.GetValue(x)).ToArray()
Dim newNode = targetNodes.Add(values)
newNode.Assign(sourceNode)

See Also

TreeListNodes Class

TreeListNodes Members

DevExpress.XtraTreeList.Nodes Namespace