method Group.AddItem (Caption as String, [Image as Variant])
Adds a new item to the group object.

TypeDescription
Caption as String A string expression that indicates the item's caption. The Caption may includes built-in HTML format if the CaptionFormat property is exHTML.
Image as Variant A long expression that indicates the item's icon
ReturnDescription
ItemAn Item object being added.

Use the AddItem method to add new items to group. Use the Add method property to add new groups to the control. The AddItem event is fired each time when a new item is added to group. Use the BeginUpdate and EndUpdate methods to maintain performance while adding new groups or new items. The Group property specifies the group that owns the item. Use the Image property to specify the item's picture. Use the Indent property to indent the item. Use the Caption property to specify the caption of the item. Use the CaptionFormat property to allow built-in HTML tags to the group's caption.

The following VB sample adds two groups and two items to each group:

With ListBar1
    .BeginUpdate
    With .Groups
        With .Add("Group 1")
            .AddItem "Item 1"
            .AddItem "Item 2"
        End With
        With .Add("Group 2")
            .AddItem "Item 1"
            .AddItem "Item 2"
        End With
    End With
    .EndUpdate
End With

The following C++ sample adds two groups and two items to each group:

#include "Item.h"
#include "Group.h"
#include "Groups.h"
COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
m_listbar.BeginUpdate();
CGroups groups = m_listbar.GetGroups();
CGroup group1 = groups.Add( "Group 1" );
group1.AddItem( "Item 1", vtMissing );
group1.AddItem( "Item 2", vtMissing );
CGroup group2 = groups.Add( "Group 2" );
group2.AddItem( "Item 1", vtMissing );
group2.AddItem( "Item 2", vtMissing );
m_listbar.EndUpdate();

The following VB.NET sample adds two groups and two items to each group:

With AxListBar1
    .BeginUpdate()
    With .Groups
        With .Add("Group 1")
            .AddItem("Item 1")
            .AddItem("Item 2")
        End With
        With .Add("Group 2")
            .AddItem("Item 1")
            .AddItem("Item 2")
        End With
    End With
    .EndUpdate()
End With

The following C# sample adds two groups and two items to each group:

axListBar1.BeginUpdate();
EXLISTBARLib.Group group1 = axListBar1.Groups.Add("Group 1");
group1.AddItem("Item 1", null);
group1.AddItem("Item 2", null);
EXLISTBARLib.Group group2 = axListBar1.Groups.Add("Group 2");
group2.AddItem("Item 1", null);
group2.AddItem("Item 2", null);
axListBar1.EndUpdate();

The following VFP sample adds two groups and two items to each group:

With thisform.ListBar1
    .BeginUpdate()
    With .Groups
        With .Add("Group 1")
            .AddItem("Item 1")
            .AddItem("Item 2")
        EndWith
        With .Add("Group 2")
            .AddItem("Item 1")
            .AddItem("Item 2")
        EndWith
    EndWith
    .EndUpdate()
EndWith