GrapeCity MultiRow for Windows Forms 11.0J
値の変更の検出

CheckBoxCellのチェック状態が変更されたことを検出するには、GcMultiRow.CellEditedFormattedValueChangedイベントを使用します。現在編集中の値は、Cell.EditedFormattedValueプロパティで取得します。
サンプルコード
次のコードは、テスト用のテンプレートを作成します。

Imports GrapeCity.Win.MultiRow

Dim CheckBoxCell1 As New CheckBoxCell()
CheckBoxCell1.Text = "Test"
GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {CheckBoxCell1})
using GrapeCity.Win.MultiRow;

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

次のコードは、ユーザーがチェックボックスのチェック状態を変更したとき、現在の値を表示します。

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("編集中のセルの値: {0}", currentCell.EditedFormattedValue)
            Console.WriteLine("セルの値: {0}", currentCell.Value)
        End If
    End If
End Sub
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("編集中のセルの値: {0}", currentCell.EditedFormattedValue);
            Console.WriteLine("セルの値: {0}", currentCell.Value);
        }
    }
}
   
関連トピック

 

 


© 2008 GrapeCity inc. All rights reserved.