# Changing the Default Keyboard Map

Customize the default input map to define end user interaction with the keyboard in Spread for .NET.

## Content

The default input map defines the behavior of the component for end user interaction with the keyboard. For example, by default, when the end user presses the Enter key in an active cell, the edit mode turns on for that cell. You can change this default behavior, by changing the default input map.

## Using Code

1. Create an [InputMap](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.InputMap.html) object.
2. Use the [GetInputMap](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.GetInputMap.html) method.

**Example**
This example changes the behavior so that pressing the Enter key moves the active cell to the next row.

```csharp
private void Form1_Load(object sender, System.EventArgs e)
{
   FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();
   
   // Define the operation of pressing Enter key in cells not being edited as "Move to the next row".
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
   
   // Define the operation of pressing Enter key in cells being edited as "Move to the next row".
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);
}
```

```vbnet
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim im As New FarPoint.Win.Spread.InputMap
   
   ' Define the operation of pressing Enter key in cells not being edited as "Move to the next row".
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)
   
   ' Define the operation of pressing Enter key in cells being edited as "Move to the next row".
im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)
End Sub
```

**Example**
This example deactivates the F2 key.

```csharp
private void Form1_Load(object sender, System.EventArgs e)
{
   FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();
   
   // Deactivate F2 key in cells not being edited.
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None);
   
   // Deactivate F2 key in cells being edited.
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
im.Put(new FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None);
}
```

```vbnet
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim im As New FarPoint.Win.Spread.InputMap
   ' Deactivate F2 key in cells not being edited.
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
   ' Deactivate F2 key in cells being edited.
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
End Sub
```

## See Also

[Keyboard Interaction](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys)
[Underlying Keystroke Processing](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-keysyswin)
[Factors of Keyboard Map Usage](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-factors)
[Default Keyboard Navigation](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-keybdnav)
[Default Keyboard Maps](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-defaultmaps)
[Deactivating the Default Keyboard Map](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-defaultoff)
[Using Input Maps with Action Maps](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-action)
[Customizing the Input Maps](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-custominput)
[Changing an Input Map for a Child View](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-child)
[Saving and Loading Map Files](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-load)
[Using the Excel Compatibility Input Maps](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-mappingkeys/spwin-maps-using)