event AfterCellEdit (Item as HITEM, ColIndex as Long, NewCaption as String)

Occurs after data in the current cell is edited.

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item being changed.  
   ColIndex as Long A long expression that specifies the index of the column where the change occurs, or a handle to a cell being edited if the Item parameter is 0.  
   NewCaption as String A string expression that indicates the newly cell's caption.  

The AfterCellEdit and BeforeCellEdit events are fired only if the AllowEdit property of the control is True. Use the Edit method to programmatically edits a cell. If the user doesn't handle the AfterCellEdit event the cell's caption remains unchanged. Use the AfterCellEdit event to change the cell's caption after user edits a cell. The AfterCellEdit event is not fired if the user has canceled the edit operation using BeforeCellEdit event. 

The following VB sample changes the cell's caption as soon as the edit operation ends.

Private Sub Gantt1_AfterCellEdit(ByVal Item As EXGANTTLibCtl.HITEM, ByVal ColIndex As Long, ByVal NewCaption As String)
    Gantt1.Items.CellCaption(Item, ColIndex) = NewCaption
End Sub

Use the BeforeCellEdit is you need to cancel editing cells. The following VB sample cancels editing of any cell that' shoted by the first column:

Private Sub Gantt1_BeforeCellEdit(ByVal Item As EXGANTTLibCtl.HITEM, ByVal ColIndex As Long, Value As Variant, Cancel As Variant)
    Cancel = ColIndex = 0
End Sub

The following VB.NET sample changes the cell's caption as soon as the edit operation ends.

Private Sub AxGantt1_AfterCellEdit(ByVal sender As Object, ByVal e As AxEXGANTTLib._IGanttEvents_AfterCellEditEvent) Handles AxGantt1.AfterCellEdit
    AxGantt1.Items.CellCaption(e.item, e.colIndex) = e.newCaption
End Sub

The following C# sample changes the cell's caption as soon as the edit operation ends.

private void axGantt1_AfterCellEdit(object sender, AxEXGANTTLib._IGanttEvents_AfterCellEditEvent e)
{
	axGantt1.Items.set_CellCaption( e.item, e.colIndex, e.newCaption );
}

The following C++ sample changes the cell's caption as soon as the edit operation ends.

void OnAfterCellEditGantt1(long Item, long ColIndex, LPCTSTR NewCaption) 
{
	m_gantt.GetItems().SetCellCaption( COleVariant( Item ), COleVariant( ColIndex ), COleVariant( NewCaption ) );
}

The following VFP sample changes the cell's caption as soon as the edit operation ends.

*** ActiveX Control Event ***
LPARAMETERS item, colindex, newcaption

with thisform.Gantt1.Items
	.DefaultItem = item
	.CellCaption( 0, colindex ) = newcaption
endwith



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