property Items.CellChecked (RadioGroup as Long) as HCELL

Retrieves the handle of the cell that is checked, given the radio group identifier.

TypeDescription
RadioGroup as Long A long expression that indicates the radio group identifier.
HCELL A long expression that indicates the cell's handle. Use the CellItem property to retrieve the handle of the owner item.

A radio group contains a set of cells of radio types. Use the CellHasRadioButton property to set the cell of radio type. To change the state for a cell you can use the CellState property. To add or remove a cell to a given radio group you have to use CellHasRadioButton property. Use the CellRadioGroup property to add cells in the same radio group. The control fires the CellStateChanged event when the check box or radio button state is changed.

The following VB sample groups all cells on the first column into a radio group, and display the cell's checked on the radio group when the state of a radio group is changed:

Private Sub ComboBox1_InsertItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM)
    With ComboBox1.Items
        .CellHasRadioButton(Item, 0) = True
        .CellRadioGroup(Item, 0) = 1234
    End With
End Sub

Private Sub ComboBox1_CellStateChanged(ByVal Cell As EXCOMBOBOXLibCtl.HCELL)
    With ComboBox1.Items
        Debug.Print "In the 1234 radio group the """ & .CellCaption(, .CellChecked(1234)) & """ is checked."
    End With
End Sub

The following C++ sample groups the radio cells on the first column, and displays the caption of the checked radio cell:

#include "Items.h"
COleVariant vtColumn( long(0) );
CItems items = m_combobox.GetItems();
m_combobox.BeginUpdate();
for ( long i = 0; i < items.GetItemCount(); i++ )
{
	COleVariant vtItem( items.GetItemByIndex( i ) );
	items.SetCellHasRadioButton( vtItem, vtColumn, TRUE );
	items.SetCellRadioGroup( vtItem, vtColumn, 1234 );
}
m_combobox.EndUpdate();
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;
}

void OnCellStateChangedCombobox1(long Cell) 
{
	if ( ::IsWindow( m_combobox.m_hWnd ) )
	{
		CItems items = m_combobox.GetItems();
		long hCell = items.GetCellChecked( 1234 );
		COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
		OutputDebugString( V2S( &items.GetCellCaption( vtMissing, COleVariant( hCell ) ) ) );
	}
}

The following VB.NET sample groups the radio cells on the first column, and displays the caption of the checked radio cell:

With AxComboBox1
    .BeginUpdate()
    With .Items
        Dim k As Integer
        For k = 0 To .ItemCount - 1
            .CellHasRadioButton(.ItemByIndex(k), 0) = True
            .CellRadioGroup(.ItemByIndex(k), 0) = 1234
        Next
    End With
    .EndUpdate()
End With
Private Sub AxComboBox1_CellStateChanged(ByVal sender As Object, ByVal e As AxEXCOMBOBOXLib._IComboBoxEvents_CellStateChangedEvent) Handles AxComboBox1.CellStateChanged, AxComboBox2.CellStateChanged
    With AxComboBox1.Items
        Debug.WriteLine(.CellCaption(, .CellChecked(1234)))
    End With
End Sub

The following C# sample groups the radio cells on the first column, and displays the caption of the checked radio cell:

axComboBox1.BeginUpdate();
EXCOMBOBOXLib.Items items = axComboBox1.Items;
for (int i = 0; i < items.ItemCount; i++)
{
	items.set_CellHasRadioButton(items[i], 0, true);
	items.set_CellRadioGroup(items[i], 0, 1234);
}
axComboBox1.EndUpdate();
private void axComboBox1_CellStateChanged(object sender, AxEXCOMBOBOXLib._IComboBoxEvents_CellStateChangedEvent e)
{
	string strOutput = axComboBox1.Items.get_CellCaption(0, axComboBox1.Items.get_CellChecked(1234)).ToString();
	strOutput += " state = " + axComboBox1.Items.get_CellState(null, e.cell).ToString();
	System.Diagnostics.Debug.WriteLine(strOutput);
}

The following VFP sample groups the radio cells on the first column, and displays the caption of the checked radio cell:

thisform.ComboBox1.BeginUpdate()
with thisform.ComboBox1.Items
	local i
	for i = 0 to .ItemCount - 1
		.DefaultItem = .ItemByIndex(i)
		.CellHasRadioButton( 0,0 ) = .t.
		.CellRadioGroup(0,0) = 1234
	next
endwith
thisform.ComboBox1.EndUpdate()

Note : The intersection of an item with a column defines a cell. Each cell is uniquely represented by its handle. The cell's handle is of HCELL type. All properties of Items object that have two parameters Item and ColIndex, refer a cell.

The following lines are equivalents and each of them changes the bold font attribute of the first cell on the first item.

With ComboBox1
    .Items.CellBold(, .Items.ItemCell(.Items(0), 0)) = True
    .Items.CellBold(.Items(0), 0) = True
    .Items.CellBold(.Items(0)) = True
    .Items.CellBold(.Items.ItemByIndex(0)) = True
    .Items.CellBold(.Items.ItemByIndex(0), 0) = True
    .Items.CellBold(.Items(0), ComboBox1.Columns(0).Caption) = True
End With