# Navigating Sheet Tabs

Use Spread.NET to develop front-ends to database applications. It gives access to multiple sheets using many types of cells and predefined sheet styles.

## Content

If a workbook contains more than one sheet, the tab strip displays the sheet name tabs with the tab for the active sheet highlighted. In this scenario, by using the previous and next tab strip buttons present in the bottom left corner of the workbook, you can navigate to the previous or next sheet of the active sheet.

## To jump to the first or last sheets

If you want to jump to the first or last sheets without any manual scrolling, follow the steps below.

1. Run the following example code to load a spread control with 6 sheets.

    ```csharp
    fpSpread1.Width = 800;
    fpSpread1.Sheets.Count = 6;
    fpSpread1.TabStripRatio = 0.7;
    ```

    ```vbnet
    FpSpread1.Width = 800
    FpSpread1.Sheets.Count = 6
    FpSpread1.TabStripRatio = 0.7
    ```
2. Hover the mouse on the tab strip buttons to display tooltips with a description of their functions.
<br>
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/gotosheet.png)

    > !type=note
    > **Note:** This tooltip functionality is only available in the Excel 2019 skin.
3. Hold **Ctrl** key and click on the **Previous** tab strip button to jump to the first sheet.
4. Hold **Ctrl** key and click on the **Next** tab strip button to jump to the last sheet.
5. Right-click on the tab strip buttons to immediately jump to the selected sheet.
    This will display the **Activate** dialog with the list of sheets available in the workbook.
    You can select any sheet of your choice from the list and click **OK** or double-click the sheet to open.
    ![](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/activate%20dialog.png)

Spread also allows you to open the **Activate** dialog using **ActivateSheet** method of the **BuiltInDialogs** class as shown below.

```csharp
// Open Activate dialog by code
fpSpread1.Sheets.Count = 3;
FarPoint.Win.Spread.Dialogs.BuiltInDialogs.ActivateSheet(fpSpread1);
```

```vbnet
' Open Activate dialog by code
FpSpread1.Sheets.Count = 3
FarPoint.Win.Spread.Dialogs.BuiltInDialogs.ActivateSheet(FpSpread1)
```

However, when not in use, you can hide the **Activate** dialog and tooltip and disable the tab strip buttons.

## To hide Activate dialog

```csharp
fpSpread1.GetActionMap().Parent.Remove(SpreadActions.ShowActivateSheetDialog);
```

```vbnet
FpSpread1.GetActionMap().Parent.Remove(SpreadActions.ShowActivateSheetDialog)
```

## To hide the tooltip for tab strip buttons

```csharp
fpSpread1.SetToolTip(SpreadToolTip.TabStripNextSheet, "");
fpSpread1.SetToolTip(SpreadToolTip.TabStripPreviousSheet, "");
```

```vbnet
FpSpread1.SetToolTip(SpreadToolTip.TabStripNextSheet, "")
FpSpread1.SetToolTip(SpreadToolTip.TabStripPreviousSheet, "")
```

## To disable tab strip buttons

```csharp
private void FpSpread1_MouseDown(object sender, MouseEventArgs e)
    {
      if ((Control.ModifierKeys & Keys.Control) != 0)
      {
        FpSpread spread = (FpSpread)sender;
        HitTestInformation ht = spread.HitTest(e.X, e.Y);
        if (ht.Type == HitTestType.TabStrip)
        {
          switch (ht.TabStripInfo.Button)
          {
            case TabStripButton.Next:
            case TabStripButton.Previous:
             spread.Capture = false;
             break;
          }
        }
      }
    }
```

```vbnet
Private Sub FpSpread1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
    If (Control.ModifierKeys And Keys.Control) <> 0 Then
        Dim spread As FpSpread = CType(sender, FpSpread)
        Dim ht As HitTestInformation = spread.HitTest(e.X, e.Y)
        If ht.Type = HitTestType.TabStrip Then
            Select Case ht.TabStripInfo.Button
                Case TabStripButton.[Next], TabStripButton.Previous
                    spread.Capture = False
            End Select
        End If
    End If
End Sub
```

## To customize tab strip button behavior

You can change the default behavior of the TabStrip buttons to personalize their functionality. When you click the previous or next tab strip buttons in the bottom left corner of the worksheet, you can navigate to the sheet before or after the active one. However, using the **TabStrip.ButtonClick** event, you may switch between sheet tabs by making the previous or next sheets as active. For example, if you are on 'Sheet1' and click the next tab strip button, then the 'Sheet2' becomes the active sheet.
The following example code depicts the use of TabStrip.ButtonClick event.

```csharp
fpSpread1.Sheets.Count = 8;
fpSpread1.TabStrip.ButtonClick += TabStrip_ButtonClick;
private void TabStrip_ButtonClick(object sender, TabStripButtonClickEventArgs e)
{
 e.Handled = true;
 if (e.Button == TabStripButton.Next)
 {
  fpSpread1.ActiveSheetIndex += 1;
 }
 else if (e.Button == TabStripButton.Previous)
 {
  fpSpread1.ActiveSheetIndex -= 1;
 }
}
```

```vbnet
FpSpread1.Sheets.Count = 8
FpSpread1.TabStrip.ButtonClick += TabStrip_ButtonClick
Private Sub TabStrip_ButtonClick(sender As Object, e As TabStripButtonClickEventArgs)
    e.Handled = true
    If e.Button Is TabStripButton.Next Then
       FpSpread1.ActiveSheetIndex += 1
    ElseIf e.Button Is TabStripButton.Previous Then
       FpSpread1.ActiveSheetIndex -= 1
    End If
End Sub
```