method Group.PutItems (Items as Variant, [Parent as Variant])

Adds an array of integer, long, date, string, double, float, or variant arrays to the group, beginning at Index.

TypeDescription
Items as Variant An array that group uses to fill with
Parent as Variant A long expression that specifies the handle of the item where the array is being inserted, or 0 if missing.

The PutItems method loads items from a safe array. The Parent parameter of the PutItems method specifies the handle of the item where the array is being inserted as child items. Use the GetItems method to get a safe array with the items in the group. Use the Items property to access the items collection. Use the AddItem method to add items one by one.

The following sample loads an array to your group:

With ExplorerTree1.Groups.Add("Group 1")
    .PutItems Array("Item 1", "Item 2", "Item 3")
End With

For instance the following sample shows how to load an array of strings.

With ExplorerTree1.Groups.Add("Group 1")
    Dim v(2, 2) As String
    v(0, 0) = "One"
    v(0, 1) = "Two"
    v(0, 2) = "Three"
    v(1, 0) = "One"
    v(1, 1) = "Two"
    v(1, 2) = "Three"
    v(2, 0) = "One"
    v(2, 1) = "Two"
    v(2, 2) = "Three"
    With .Columns
        With .Item(0)
            .Width = 64
        End With
        With .Add("Column 2")
            .Width = 64
        End With
        With .Add("Column 3")
            .Width = 64
        End With
    End With
    .PutItems v
End With

The following sample shows loads items to a group using an ADO table:

With ExplorerTree1.Groups.Add("Group 1")
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open "Orders", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB", 3 ' Opens the table using static mode
    .BeginUpdate
    .ColumnAutoResize = False
    .HeaderVisible = True
    With .Columns
        .Clear
        For Each f In rs.Fields
            .Add f.Name
        Next
    End With
    .PutItems rs.GetRows()
    .EndUpdate
End With