Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Show and Hide a Worksheet

  • 2 minutes to read

This example demonstrates how to manage worksheet visibility in a workbook. To do this, use the following properties.

Note

A workbook must always contain at least one visible worksheet.

View Example

// Hide the "Sheet2" worksheet and prevent end-users from unhiding it via the user interface.
// To make this worksheet visible again, use the Worksheet.Visible property.
workbook.Worksheets["Sheet2"].VisibilityType = WorksheetVisibilityType.VeryHidden;

// Hide the "Sheet3" worksheet. 
// In this state, the worksheet can be unhidden via the user interface.
workbook.Worksheets["Sheet3"].Visible = false;

After executing the code above, the “Sheet2” worksheet is hidden, and cannot be accessed by an end-user in SpreadsheetControl. The “Sheet3” worksheet is also hidden, but its visibility can be restored by an end-user.

SpreadsheetControl_Worksheet_Hide

See Also