event BeforeCellEdit (ItemIndex as Long, ColIndex as Long, Value as Variant, Cancel as Variant)
Occurs just before the user enters edit mode by clicking in a cell.

TypeDescription
ItemIndex as Long A long expression that indicates the index of item that being edited.
ColIndex as Long A long expression that indicates the index of column being edited.
Value as Variant A string value that indicates the cell's caption being edited.
Cancel as Variant A boolean expression that indicates whether the edit operation is canceled or not.

The BeforeCellEdit event notifies your application that a cell starts editing. Use the BeforeCellEdit event to cancel editing a cell. The control fires the BeforeCellEdit and AfterCellEdit events only if the AllowEdit property is True. Use the Edit method to edit programmatically a cell.

Syntax for BeforeCellEdit event, /NET version, on:

private void BeforeCellEdit(object sender,int ItemIndex,int ColIndex,ref object Value,ref object Cancel)
{
}

Private Sub BeforeCellEdit(ByVal sender As System.Object,ByVal ItemIndex As Integer,ByVal ColIndex As Integer,ByRef Value As Object,ByRef Cancel As Object) Handles BeforeCellEdit
End Sub

Syntax for BeforeCellEdit event, /COM version, on:

private void BeforeCellEdit(object sender, AxEXLISTLib._IListEvents_BeforeCellEditEvent e)
{
}

void OnBeforeCellEdit(long ItemIndex,long ColIndex,VARIANT FAR* Value,VARIANT FAR* Cancel)
{
}

void __fastcall BeforeCellEdit(TObject *Sender,long ItemIndex,long ColIndex,Variant * Value,Variant * Cancel)
{
}

procedure BeforeCellEdit(ASender: TObject; ItemIndex : Integer;ColIndex : Integer;var Value : OleVariant;var Cancel : OleVariant);
begin
end;

procedure BeforeCellEdit(sender: System.Object; e: AxEXLISTLib._IListEvents_BeforeCellEditEvent);
begin
end;

begin event BeforeCellEdit(long ItemIndex,long ColIndex,any Value,any Cancel)
end event BeforeCellEdit

Private Sub BeforeCellEdit(ByVal sender As System.Object, ByVal e As AxEXLISTLib._IListEvents_BeforeCellEditEvent) Handles BeforeCellEdit
End Sub

Private Sub BeforeCellEdit(ByVal ItemIndex As Long,ByVal ColIndex As Long,Value As Variant,Cancel As Variant)
End Sub

Private Sub BeforeCellEdit(ByVal ItemIndex As Long,ByVal ColIndex As Long,Value As Variant,Cancel As Variant)
End Sub

LPARAMETERS ItemIndex,ColIndex,Value,Cancel

PROCEDURE OnBeforeCellEdit(oList,ItemIndex,ColIndex,Value,Cancel)
RETURN

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

<SCRIPT EVENT="BeforeCellEdit(ItemIndex,ColIndex,Value,Cancel)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function BeforeCellEdit(ItemIndex,ColIndex,Value,Cancel)
End Function
</SCRIPT>

Procedure OnComBeforeCellEdit Integer llItemIndex Integer llColIndex Variant llValue Variant llCancel
	Forward Send OnComBeforeCellEdit llItemIndex llColIndex llValue llCancel
End_Procedure

METHOD OCX_BeforeCellEdit(ItemIndex,ColIndex,Value,Cancel) CLASS MainDialog
RETURN NIL

void onEvent_BeforeCellEdit(int _ItemIndex,int _ColIndex,COMVariant /*variant*/ _Value,COMVariant /*variant*/ _Cancel)
{
}

function BeforeCellEdit as v (ItemIndex as N,ColIndex as N,Value as A,Cancel as A)
end function

function nativeObject_BeforeCellEdit(ItemIndex,ColIndex,Value,Cancel)
return

The following VB sample disables editing the cells on the second column:

Private Sub List1_BeforeCellEdit(ByVal Index As Long, ByVal ColIndex As Long, Value As Variant, Cancel As Variant)
    Cancel = ColIndex = 1
End Sub

The following C++ sample disables editing the cells on the second column:

void OnBeforeCellEditList1(long ItemIndex, long ColIndex, VARIANT FAR* Value, VARIANT FAR* Cancel) 
{
	if ( ColIndex == 1 )
	{
		V_VT( Cancel ) = VT_BOOL;
		V_BOOL( Cancel ) = VARIANT_TRUE;
	}
}

The following VB.NET sample disables editing the cells on the second column:

Private Sub AxList1_BeforeCellEdit(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_BeforeCellEditEvent) Handles AxList1.BeforeCellEdit
    If (e.colIndex = 1) Then
        e.cancel = True
    End If
End Sub

The following C# sample disables editing the cells on the second column:

private void axList1_BeforeCellEdit(object sender, AxEXLISTLib._IListEvents_BeforeCellEditEvent e)
{
	if (e.colIndex == 1)
		e.cancel = true;
}

The following VFP sample disables editing the cells on the second column:

*** ActiveX Control Event ***
LPARAMETERS itemindex, colindex, value, cancel

if ( colindex = 1 )
	cancel = .t.
endif