event Change (Item as HITEM, ColIndex as Long, ByRef NewValue as Variant)
Occurs when the user changes the cell's content.

TypeDescription
Item as HITEM A long expression that determines the item's handle. If the Item parameter is 0, and the ColIndex property is different than zero, the ColIndex indicates the handle of the cell where the state is changed.
ColIndex as Long A long expression that indicates the column's index, if the Item parameter is not zero, a long expression that indicates the handle of the cell if the Item parameter is 0.
NewValue as Variant (By Reference) A Variant value that indicates the changed cell's value

The Change event notifies your application that the user changes the control's content. The Change event is fired when the CellValue property is changed. During the Change event it is possible to have recursive calls, if you are changing the CellValue property ( only when you assign a value to a cell, not when you are retrieving the cell's value ). 

Syntax for Change event, /NET version, on:

private void Change(object sender,int Item,int ColIndex,ref object NewValue)
{
}

Private Sub Change(ByVal sender As System.Object,ByVal Item As Integer,ByVal ColIndex As Integer,ByRef NewValue As Object) Handles Change
End Sub

Syntax for Change event, /COM version, on:

private void Change(object sender, AxEXG2ANTTLib._IG2anttEvents_ChangeEvent e)
{
}

void OnChange(long Item,long ColIndex,VARIANT FAR* NewValue)
{
}

void __fastcall Change(TObject *Sender,Exg2anttlib_tlb::HITEM Item,long ColIndex,Variant * NewValue)
{
}

procedure Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
end;

procedure Change(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_ChangeEvent);
begin
end;

begin event Change(long Item,long ColIndex,any NewValue)
end event Change

Private Sub Change(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_ChangeEvent) Handles Change
End Sub

Private Sub Change(ByVal Item As EXG2ANTTLibCtl.HITEM,ByVal ColIndex As Long,NewValue As Variant)
End Sub

Private Sub Change(ByVal Item As Long,ByVal ColIndex As Long,NewValue As Variant)
End Sub

LPARAMETERS Item,ColIndex,NewValue

PROCEDURE OnChange(oG2antt,Item,ColIndex,NewValue)
RETURN

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

<SCRIPT EVENT="Change(Item,ColIndex,NewValue)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function Change(Item,ColIndex,NewValue)
End Function
</SCRIPT>

Procedure OnComChange HITEM llItem Integer llColIndex Variant llNewValue
	Forward Send OnComChange llItem llColIndex llNewValue
End_Procedure

METHOD OCX_Change(Item,ColIndex,NewValue) CLASS MainDialog
RETURN NIL

void onEvent_Change(int _Item,int _ColIndex,COMVariant /*variant*/ _NewValue)
{
}

function Change as v (Item as OLE::Exontrol.G2antt.1::HITEM,ColIndex as N,NewValue as A)
end function

function nativeObject_Change(Item,ColIndex,NewValue)
return

If you are changing the other cell's value, during the Change event you have to add a C++ code like follows in order to avoid recursive calls:

static sg_ChangeCounter = 0;
void OnChangeG2antt1(long Item, long ColIndex, VARIANT FAR* NewValue) 
{
	if ( sg_ChangeCounter == 0)
	{
		sg_ChangeCounter++;
		m_Items.SetCellValue( COleVariant( Item ), COleVariant( (long)othercolumn ), *NewValue );
		sg_ChangeCounter--;
	}
}

or in VB you could have like this:

Private sg_ChangeCounter As Long
Private Sub G2antt1_Change(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, NewValue As Variant)
    If (sg_ChangeCounter = 0) Then
        sg_ChangeCounter = sg_ChangeCounter + 1
        G2antt1.Items.CellValue(Item, othercolumn) = NewValue
        sg_ChangeCounter = sg_ChangeCounter - 1
    End If
End Sub

Use the CellEditor or Editor property to assign an editor to a cell or to a column. Use the Edit event  to notify your application that the editing operation begins. The Change event notifies that the editing focused cell ended. If the control is bounded to an ADO recordset the Change event is automatically called when the user changes the focused cell, and it updates the recordset too. The control fires the ValidateValue event before calling the Change event, if the CauseValidateValue property is True. Please note that the Change event is called also when loading, or adding new items , so you need to use an internal counter ( like explained bellow ) to avoid calling the Change event during adding or loading the items, if it is not case ( increases the iChanging variable before loading items, and decreases the iChanging member when adding items is done ). Call the Refresh method, when changing the value for a cell that has the CellSingleLine property on False.

The following VB sample displays the newly value of the focused cell:

Private Sub G2antt1_Change(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, NewValue As Variant)
    ' Displays the old/new cell's value
    Debug.Print "The current cell's value is '" & G2antt1.Items.CellValue(Item, ColIndex) & "'."
    Debug.Print "The newly cell's value is '" & NewValue & "'."
End Sub

You can change the newly cell's value by changing the NewValue parameter of the Change event. If you are changing the CellValue property during the Change event a recursive calls occurs, so you need to protect recursive calls using an internal counter that's increased when Change event starts, and decreased when the Change event ends like in the following VB sample:

Private iChanging As Long

Private Sub G2antt1_Change(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, NewValue As Variant)
    If (iChanging = 0) Then
        iChanging = iChanging + 1
            ' here's safe to change the Items.CellValue property
        iChanging = iChanging - 1
    End If
End Sub

The following sample is the C++ equivalent:

long iChanging = 0;
void OnChangeG2antt1(long Item, long ColIndex, VARIANT FAR* NewValue) 
{
	if ( iChanging == 0 )
	{
		iChanging++;
		// here's safe to call Items.CellValue property, to avoid recursive calls.
		iChanging--;
	}
}

The following C++ sample displays the newly value of the focused cell:

#include "Items.h"
void OnChangeG2antt1(long Item, long ColIndex, VARIANT FAR* NewValue) 
{
	if ( ::IsWindow( m_g2antt.m_hWnd ) )
	{
		CItems items = m_g2antt.GetItems();
		COleVariant vtItem( Item ), vtColumn( ColIndex );
		CString strFormat;
		strFormat.Format( "'%s' = %s", V2S( &items.GetCellValue( vtItem, vtColumn ) ), V2S( NewValue ) );
		OutputDebugString( strFormat );
	}
}

where the V2S function converts a VARIANT to a string value, and may look like follows:

static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return szDefault;

		COleVariant vt;
		vt.ChangeType( VT_BSTR, pv );
		return V_BSTR( &vt );
	}
	return szDefault;
}

The following VB.NET sample displays the newly value of the focused cell:

Private Sub AxG2antt1_Change(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_ChangeEvent) Handles AxG2antt1.Change
    With AxG2antt1.Items
        Debug.Print("Old Value: " & .CellValue(e.item, e.colIndex) & " New Value " & e.newValue.ToString())
    End With
End Sub

The following C# sample displays the newly value of the focused cell:

private void axG2antt1_Change(object sender, AxEXG2ANTTLib._IG2anttEvents_ChangeEvent e)
{
	System.Diagnostics.Debug.WriteLine("Old Value " + axG2antt1.Items.get_CellValue(e.item, e.colIndex).ToString() + " New Value " + e.newValue.ToString());
}

The following VFP sample displays the newly value of the focused cell:

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

with thisform.G2antt1.Items
	.DefaultItem = item
	local oldvalue
	oldvalue = .CellValue(0,colindex)
	wait window nowait "Old Value " + str(oldvalue)
	wait window nowait "New Value " + str(newvalue)
endwith