[]
When users edit a cell, the system supports two editing modes:
Input Mode: Overwrites the existing cell content.
Edit Mode: Appends or inserts content based on the existing content.
The editing mode of a cell depends on the user's operation, as described below:
Ways to Start Editing | Cell State | Arrow Key Handling |
|---|---|---|
Entering input via keyboard in the active cell | "Input" (overwrite) | Moves to another active cell |
Double-clicking the cell | "Edit" (insert at mouse position) | Moves the insertion point (cursor) within the cell |
Pressing the [F2] key | "Edit" (append to the end) | Moves the insertion point (cursor) within the cell |
Note: Arrow keys refer to the up, down, left, and right arrow keys, as well as the [Home] and [End] keys.
You can disable users from editing cells using the following methods:
Method | Description | Setting Method |
|---|---|---|
Locking the cell | Users can select the cell but cannot edit it. When switching the active cell using [Enter], [Tab], or similar operations, the focus will move to these cells. | Set the Locked property of the cell, row, or column. |
Set as read-only cell | Users can select the cell and move the focus to the editor, partially select and copy the cell content, but cannot modify the content. When moving the active cell with keys such as [Enter] or [Tab], the focus will also move to these cells. | Set the IsReadOnly property to True for editable cell types (such as standard, text, editable drop-down, date/time, mask, numeric, etc.). |
When editing a cell, the control raises various events, such as the beginning and end of the editing process. This section explains the different events that are triggered during cell editing operations.
When a cell enters edit mode, EditStarting event is triggered by the control.
After editing is complete, EditEnd event is triggered by the control.
When the value of a cell changes, CellValueChanged event is triggered to indicate that the cell’s value has been modified.
The following code demonstrates how to display a message box when a cell finishes editing, either by pressing Enter or leaving the edit mode.
private void GcSpreadSheet1_EditEnd(object sender, EventArgs e)
{
MessageBox.Show("End of cell editing!");
}Private Sub GcSpreadSheet1_EditEnd(sender As Object, e As EventArgs)
MessageBox.Show("End of cell editing!")
End Sub