![]() | Type | Description | ||
| ItemIndex as Long | A long value that indicates the index of the item where the cell's state being changed. | |||
| ColIndex as Long | A long value that indicates the column's index. |
A cell that contains a radio button or a check box button fires the CellStateChanged event when its state is changed. Use the CellState property to change the cell's state. Use the CellHasRadioButton or CellHasCheckBox property to enable radio or check box button into a cell. Use the CellImage property to display an icon in the cell. Use the CellImages property to display multiple icons in the same cell. Use the CellChecked property to determine the handle of the cell that's checked in a radio group. Use the CellRadioGroup property to radio group cells.
The following VB sample displays the caption of the cell that's checked into a radio group:
Private Sub List1_CellStateChanged(ByVal Index As Long, ByVal ColIndex As Long)
With List1.Items
Dim i As Long, c As Long
.CellChecked 1234, i, c
Debug.Print .Caption(i, c)
End With
End SubUse the CellRadioGroup property to group cells into the same radio group.
The following VB sample groups the cells in the second column:
Dim i As Long
With List1.Items
For i = 0 To .Count - 1
.CellHasRadioButton(i, 1) = True
.CellRadioGroup(i, 1) = 1234
Next
End WithThe following VB sample prints the caption of the cell's whose state is changed:
Private Sub List1_CellStateChanged(ByVal ItemIndex As Long, ByVal ColIndex As Long)
With List1.Items
Debug.Print .Caption(Index, ColIndex)
End With
End SubThe following C++ sample prints the caption of the cell's whose state is changed:
void OnCellStateChangedList1(long ItemIndex, long ColIndex)
{
if ( IsWindow( m_list.m_hWnd ) )
{
CItems items = m_list.GetItems();
CString strCaption = V2S( &items.GetCaption( ItemIndex, COleVariant( ColIndex ) ) );
OutputDebugString( strCaption );
}
}The following VB.NET sample prints the caption of the cell's whose state is changed:
Private Sub AxList1_CellStateChanged(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_CellStateChangedEvent) Handles AxList1.CellStateChanged
With AxList1.Items
Debug.Write(.Caption(e.itemIndex, e.colIndex))
End With
End SubThe following C# sample prints the caption of the cell's whose state is changed:
private void axList1_CellStateChanged(object sender, AxEXLISTLib._IListEvents_CellStateChangedEvent e)
{
System.Diagnostics.Debug.WriteLine(axList1.Items.get_Caption(e.itemIndex, e.colIndex).ToString());
}The following VFP sample prints the caption of the cell's whose state is changed:
*** ActiveX Control Event *** LPARAMETERS itemindex, colindex with thisform.List1.Items wait window nowait .Caption(itemindex,colindex) endwith