property Items.CellParent ([Item as Variant], [ColIndex as Variant]) as Variant
Retrieves the parent of an inner cell.

TypeDescription
Item as Variant A long expression that indicates the handle of the item where the cell is, or 0. If the Item parameter is 0, the ColIndex parameter must indicate the handle of the cell.
ColIndex as Variant A long expression that indicates the index of the column where a cell is divided, or a long expression that indicates the handle of the cell being divided, if the Item parameter is missing or it is zero.
Variant A long expression that indicates the handle of the parent cell. 
Use the CellParent property to get the parent of the inner cell. The SplitCell method splits a cell in two cells ( the newly created cell is called inner cell ). Use the InnerCell property to get the inner cell. Use the CellItem property to get the item that's the owner of the cell. Use the ItemCell property to get a master cell giving the handle of the item and the index of the column. The CellParent property gets 0 if the cell is the master cell, not an inner cell. The parent cell is always displayed to the left side of the cell. The inner cell ( InnerCell ) is displayed to the right side of the cell.

The following VB sample determines whether the cell is a master cell or an inner cell:

Private Function isMaster(ByVal g As EXGRIDLibCtl.Grid, ByVal h As EXGRIDLibCtl.HITEM, ByVal c As Long) As Boolean
    With g.Items
        isMaster = .CellParent(h, c) = 0
    End With
End Function

The following VB sample determines the master cell ( the cell from where the splitting starts ):

Private Function getMaster(ByVal g As EXGRIDLibCtl.Grid, ByVal h As EXGRIDLibCtl.HITEM, ByVal c As Long) As EXGRIDLibCtl.HCELL
    With g.Items
        Dim r As EXGRIDLibCtl.HCELL
        r = c
        If Not (h = 0) Then
            r = .ItemCell(h, c)
        End If
        While Not (.CellParent(, r) = 0)
            r = .CellParent(, r)
        Wend
        getMaster = r
    End With
End Function

The following C++ sample determines whether the cell is a master cell or an inner cell:

#include "Items.h"

static long V2I( VARIANT* pv, long nDefault = 0 )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return nDefault;

		COleVariant vt;
		vt.ChangeType( VT_I4, pv );
		return V_I4( &vt );
	}
	return nDefault;
}

BOOL isMaster( CGrid grid, long hItem, long nColIndex )
{
	return V2I( &grid.GetItems().GetCellParent( COleVariant( hItem ), COleVariant( nColIndex ) ) ) == 0;
}

The following C++ sample determines the master cell ( the cell from where the splitting starts ):

long getMaster( CGrid grid, long hItem, long nColIndex )
{
	COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
	CItems items = grid.GetItems();
	long r = nColIndex;
	if ( hItem )
		r = items.GetItemCell( hItem, COleVariant( nColIndex ) );
	long r2 = 0;
	while ( r2 = V2I( &items.GetCellParent( vtMissing, COleVariant( r ) ) ) )
		r = r2;
	return r;
}

The following VB.NET sample determines whether the cell is a master cell or an inner cell:

Private Function isMaster(ByVal g As AxEXGRIDLib.AxGrid, ByVal h As Long, ByVal c As Long) As Boolean
    With g.Items
        isMaster = .CellParent(h, c) = 0
    End With
End Function

The following VB.NET sample determines the master cell ( the cell from where the splitting starts ):

Shared Function getMaster(ByVal g As AxEXGRIDLib.AxGrid, ByVal h As Integer, ByVal c As Integer) As Integer
    With g.Items
        Dim r As Integer
        r = c
        If Not (h = 0) Then
            r = .ItemCell(h, c)
        End If
        While Not (.CellParent(, r) = 0)
            r = .CellParent(, r)
        End While
        getMaster = r
    End With
End Function

The following C# sample determines whether the cell is a master cell or an inner cell:

private bool isMaster(AxEXGRIDLib.AxGrid grid, int h, int c)
{
	return Convert.ToInt32(grid.Items.get_CellParent(h, c)) != 0;
}

The following C# sample determines the master cell ( the cell from where the splitting starts ):

private long getMaster(AxEXGRIDLib.AxGrid g, int h, int c)
{
	int r = c, r2 = 0;
	if ( h != 0 )
		r = Convert.ToInt32( g.Items.get_ItemCell(h,c) );
	r2 = Convert.ToInt32( g.Items.get_CellParent(null, r));
	while ( r2 != 0)
	{
		r = r2;
		r2 = Convert.ToInt32( g.Items.get_CellParent(null, r));
	}
	return r;
}