GrapeCity MultiRow Windows Forms Documentation
Edit Modes

GcMultiRow supports three types of edit modes. You can set the edit mode using the GcMultiRow.EditMode property and the GcMultiRow.ReadOnly property. Refer to the Shortcut Keys section for details on shortcuts for each of these modes. Refer to the Editing Cells section for details regarding the advanced customization of editing cells.

Default Mode

You can select or edit the cells in the default mode. By default, the input mode begins when user enters in the cell or double clicks on it. Input is confirmed by pressing the Enter key or by moving the focus to other cells. This mode is the same as that in Excel or DataGridView. This is the default edit mode for the GcMultiRow control.

Using Code

The following code sets the grid to the default edit mode.

[VB]

GcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnKeystrokeOrShortcutKey

[CS]

gcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnKeystrokeOrShortcutKey;

Using Code

To prevent editing using the keyboard and only allow editing using shortcut operations, use the following code.

[VB]

GcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnShortcutKey

[CS]

gcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnShortcutKey;

Continuous Input Mode

In continuous input mode, the cells are always in edit mode. This mode is the same as the TextBox control. The cells can be edited as soon as the user moves the focus to the cell.

Using Code

This example puts the grid into continuous input mode.

[VB]

GcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnEnter

[CS]

gcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnEnter;
  • Continuous input mode is disabled when the GcMultiRow.ReadOnly property is set to True or the GcMultiRow.ViewMode property is set to Display.
  • It is not possible to select cells by dragging when continuous input mode is enabled.
  • Cell editing starts automatically when the cells are moved using the keyboard, so scrolling is slower when using the keyboard in the continuous input mode.
  • In continuous input mode, editing results cannot be confirmed until you have moved off the cell. Be careful when referencing the value of a cell in edit mode because the values in the cell editing control and the values in the grid cell are different. The cell editing control retains the value being edited and the grid cell contains the value before it was edited. This behavior is also true in cases where continuous input mode has been implemented using a procedure other than using the GcMultiRow.EditMode property.

Continuous input mode works for all editable cell types. In order to decide whether to use continuous input mode based on cell types, you can set the GcMultiRow.EditMode property to a value other than EditOnEnter, and call the GcMultiRow.BeginEdit method in the CellEnter event.

Using Code

In the following sample code, continuous input mode is only enabled in string type cells.

[VB]

Imports GrapeCity.Win.MultiRow

Private Sub GcMultiRow1_CellEnter( _
    ByVal sender As System.Object, _
    ByVal e As CellEventArgs _
    ) Handles GcMultiRow1.CellEnter
    If TypeOf GcMultiRow1.CurrentCell Is TextBoxCell Then
        GcMultiRow1.BeginEdit(False)
    End If
End Sub

[CS]

using GrapeCity.Win.MultiRow;

private void gcMultiRow1_CellEnter(object sender, CellEventArgs e)
{
    if (gcMultiRow1.CurrentCell is TextBoxCell)
        gcMultiRow1.BeginEdit(false);
}

Read-Only Mode

Setting the GcMultiRow.ReadOnly property to True, allows you to set the grid to read-only regardless of the settings in the GcMultiRow.EditMode property.

Using Code

The following example sets the grid to be read-only.

[VB]

GcMultiRow1.ReadOnly = True

[CS]

gcMultiRow1.ReadOnly = true;

You can set the GcMultiRow.EditMode property to False and the ReadOnly property of each of the cells to True, in order to allow cell editing but restrict editing of the content (similar to a read-only text box). You can select the display mode if you do not wish to allow cell selection. Refer to the View Modes section for details regarding display mode.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options