event AfterCellEdit (Group as Group, Item as HITEM, ColIndex as Long, NewCaption as String)
Occurs after data in the current cell is edited.

 TypeDescription 
   Group as Group A Group object where the user edits an item.  
   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 group 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 sample shows how to change the cell's caption when the edit operation ends.

Private Sub ExplorerTree1_AfterCellEdit(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM, ByVal ColIndex As Long, ByVal NewCaption As String)
    With Group.Items
        .CellCaption(Item, ColIndex) = NewCaption
    End With
End Sub

Use the BeforeCellEdit is you need to cancel editing cells. The following sample shows how to cancel editing of any cell owned by the first column:

Private Sub ExplorerTree1_BeforeCellEdit(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM, ByVal ColIndex As Long, Value As Variant, Cancel As Variant)
    Cancel = ColIndex = 0
End Sub


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