MultiRow Windows Forms > Developer's Guide > Using MultiRow > Grid > 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.
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.
The following code sets the grid to the default edit mode.
GcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnKeystrokeOrShortcutKey |
gcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnKeystrokeOrShortcutKey; |
To prevent editing using the keyboard and only allow editing using shortcut operations, use the following code.
GcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnShortcutKey |
gcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnShortcutKey; |
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.
This example puts the grid into continuous input mode.
GcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnEnter |
gcMultiRow1.EditMode = GrapeCity.Win.MultiRow.EditMode.EditOnEnter; |
![]() |
|
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.
In the following sample code, continuous input mode is only enabled in string type cells.
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 |
using GrapeCity.Win.MultiRow; private void gcMultiRow1_CellEnter(object sender, CellEventArgs e) { if (gcMultiRow1.CurrentCell is TextBoxCell) gcMultiRow1.BeginEdit(false); } |
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.
The following example sets the grid to be read-only.
GcMultiRow1.ReadOnly = True |
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.