GrapeCity MultiRow Windows Forms Documentation
Detect Value Change (CheckBoxCell)

You can use the GcMultiRow.CellEditedFormattedValueChanged event to detect changes in the checked status of the check box cell. The value being edited can be returned by the Cell.EditedFormattedValue property.

Using Code

This code creates a test template.

[VB]

Imports GrapeCity.Win.MultiRow

Dim checkBoxCell1 As New CheckBoxCell()
checkBoxCell1.Text = "Test"
GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {checkBoxCell1})

[CS]

using GrapeCity.Win.MultiRow;

CheckBoxCell checkBoxCell1 = new CheckBoxCell();
checkBoxCell1.Text = "Test";
gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { checkBoxCell1 });

This code shows the current value when the checkbox status has been changed by the user.

[VB]

Imports GrapeCity.Win.MultiRow

Private Sub GcMultiRow1_CellEditedFormattedValueChanged(ByVal sender As System.Object, ByVal e As CellEditedFormattedValueChangedEventArgs) Handles GcMultiRow1.CellEditedFormattedValueChanged

    Dim currentCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex)

    If e.Scope = CellScope.Row Then
        If TypeOf currentCell Is CheckBoxCell Then
            Console.WriteLine("Cell value being edited: {0}", currentCell.EditedFormattedValue)
            Console.WriteLine("Cell Value: {0}", currentCell.Value)
        End If
    End If
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void gcMultiRow1_CellEditedFormattedValueChanged(object sender, CellEditedFormattedValueChangedEventArgs e)
{
    Cell currentCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex];
    
    if (e.Scope == CellScope.Row)
    {
        if (currentCell is CheckBoxCell)
        {
            Console.WriteLine("Cell value being edited: {0}", currentCell.EditedFormattedValue);
            Console.WriteLine("Cell Value: {0}", currentCell.Value);
        }
    }
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options