GrapeCity MultiRow Windows Forms Documentation
Usage of ValueChanged Event (DateTimePickerCell)

You can use the DateTimePickerEditingControl.ValueChanged event to perform the same processing as the DateTimePicker.ValueChanged event in the date time picker cell.

Using Code

This example uses the ValueChanged event.

[VB]

Imports GrapeCity.Win.MultiRow

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    GcMultiRow1.Template = Template.CreateGridTemplate(New Cell() {New DateTimePickerCell()})
End Sub

Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
    If TypeOf e.Control Is DateTimePickerEditingControl Then
        Dim dateTimePickerEditingControl1 As DateTimePickerEditingControl = TryCast(e.Control, DateTimePickerEditingControl)
        RemoveHandler dateTimePickerEditingControl1.ValueChanged, AddressOf Me.dateTimePickerEditingControl1_ValueChanged
        AddHandler dateTimePickerEditingControl1.ValueChanged, AddressOf Me.dateTimePickerEditingControl1_ValueChanged
    End If
End Sub

Private Sub dateTimePickerEditingControl1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim dateTimePickerEditingControl1 As DateTimePickerEditingControl = TryCast(sender, DateTimePickerEditingControl)
    Dim gcMultiRow As GcMultiRow = dateTimePickerEditingControl1.GcMultiRow

    Console.WriteLine(gcMultiRow.CurrentCellPosition.ToString())
    Console.WriteLine(dateTimePickerEditingControl1.Value.ToString())
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void Form1_Load(object sender, EventArgs e)
{
    gcMultiRow1.Template = Template.CreateGridTemplate(new Cell[] { new DateTimePickerCell() });
    gcMultiRow1.EditingControlShowing += new EventHandler<EditingControlShowingEventArgs>(gcMultiRow1_EditingControlShowing);

}

private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e)
{
    if (e.Control is DateTimePickerEditingControl)
    {
        DateTimePickerEditingControl dateTimePickerEditingControl1 = e.Control as DateTimePickerEditingControl;
        dateTimePickerEditingControl1.ValueChanged -= new EventHandler(dateTimePickerEditingControl1_ValueChanged);
        dateTimePickerEditingControl1.ValueChanged += new EventHandler(dateTimePickerEditingControl1_ValueChanged);
    }
}

private void dateTimePickerEditingControl1_ValueChanged(object sender, EventArgs e)
{
    DateTimePickerEditingControl dateTimePickerEditingControl1 = sender as DateTimePickerEditingControl;
    GcMultiRow gcMultiRow = dateTimePickerEditingControl1.GcMultiRow;

    Console.WriteLine(gcMultiRow.CurrentCellPosition.ToString());
    Console.WriteLine(dateTimePickerEditingControl1.Value.ToString());
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options