method Nodes.Add (Name as String, [Value as Variant], [Key as Variant])
Adds a child node and returns a reference to the newly created object.

TypeDescription
Name as String A string expression that indicates the name of the node being inserted. 
Value as Variant A Variant expression that indicates the value of the node being inserted.
Key as Variant A string or long expression that indicates the key of the node being inserted.
ReturnDescription
NodeA Node object being created.
Use the Add method to add new nodes to the control. Use the LoadXML method to load XML documents. Use the Nodes property to access the node's child nodes collection. Use the Editors property to access the control's Editors collection. The control fires the AddNode event when a new node is inserted to the control's nodes collection. The Name and Value parameters support built-in HTML format. Use the Parent property to get the node's parent. The AllowDuplicateEntries property returns or sets a value that specifies whether the control supports nodes with the same key ( duplicates ).

The following sample adds few nodes to the control's nodes collection.

Private Sub Form_Load()
    With XMLGrid1
        .BeginUpdate
        
        With .Nodes
            With .Add("Root").Nodes
                .Add "Child 1", "text1"
                .Add "Child 2", "text2"
            End With
        End With
        .EndUpdate
    End With
End Sub