event AddItem (ItemIndex as Long)
Occurs after a new item has been inserted to Items collection.

 TypeDescription 
   ItemIndex as Long A long expression that indicates the index of the item being added.  

The control fires the AddItem event when a new item is added. Use the Add method to add new items to the control. Use the AddItem event to associate extra data to the  item. Use the Add method to add a new column to the control. Use the PutItems to add items from  safe array. Use the DataSource property to add columns and items from a recordset.

The following VB sample bolds the cells in the first column, when a new items is inserted:

Private Sub List1_AddItem(ByVal Index As Long)
    With List1.Items
        .CellBold(Index, 0) = True
    End With
End Sub

The following C++ sample bolds the cells in the first column, when a new items is inserted:

void OnAddItemList1(long ItemIndex) 
{
	if ( IsWindow( m_list.m_hWnd ) )
	{
		CItems items = m_list.GetItems();
		items.SetCellBold( ItemIndex, COleVariant( long( 0 ) ), TRUE );
	}
}

The following VB.NET sample bolds the cells in the first column, when a new items is inserted:

Private Sub AxList1_AddItem(ByVal sender As System.Object, ByVal e As AxEXLISTLib._IListEvents_AddItemEvent) Handles AxList1.AddItem
    With AxList1.Items
        .CellBold(e.itemIndex, 0) = True
    End With
End Sub

The following C# sample bolds the cells in the first column, when a new items is inserted:

private void axList1_AddItem(object sender, AxEXLISTLib._IListEvents_AddItemEvent e)
{
	axList1.Items.set_CellBold(e.itemIndex, 0, true);
}

The following VFP sample bolds the cells in the first column, when a new items is inserted:

*** ActiveX Control Event ***
LPARAMETERS itemindex

with thisform.List1.Items
	.CellBold( itemIndex, 0) = .t.
endwith



Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.