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.

Syntax for AddItem event, /NET version, on:

private void AddItem(object sender,int ItemIndex)
{
}

Private Sub AddItem(ByVal sender As System.Object,ByVal ItemIndex As Integer) Handles AddItem
End Sub

Syntax for AddItem event, /COM version, on:

private void AddItem(object sender, AxEXLISTLib._IListEvents_AddItemEvent e)
{
}

void OnAddItem(long ItemIndex)
{
}

void __fastcall AddItem(TObject *Sender,long ItemIndex)
{
}

procedure AddItem(ASender: TObject; ItemIndex : Integer);
begin
end;

procedure AddItem(sender: System.Object; e: AxEXLISTLib._IListEvents_AddItemEvent);
begin
end;

begin event AddItem(long ItemIndex)
end event AddItem

Private Sub AddItem(ByVal sender As System.Object, ByVal e As AxEXLISTLib._IListEvents_AddItemEvent) Handles AddItem
End Sub

Private Sub AddItem(ByVal ItemIndex As Long)
End Sub

Private Sub AddItem(ByVal ItemIndex As Long)
End Sub

LPARAMETERS ItemIndex

PROCEDURE OnAddItem(oList,ItemIndex)
RETURN

Syntax for AddItem event, /COM version (others), on:

<SCRIPT EVENT="AddItem(ItemIndex)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function AddItem(ItemIndex)
End Function
</SCRIPT>

Procedure OnComAddItem Integer llItemIndex
	Forward Send OnComAddItem llItemIndex
End_Procedure

METHOD OCX_AddItem(ItemIndex) CLASS MainDialog
RETURN NIL

void onEvent_AddItem(int _ItemIndex)
{
}

function AddItem as v (ItemIndex as N)
end function

function nativeObject_AddItem(ItemIndex)
return

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-2017 Exontrol.COM, Software. All rights reserved.