Question

I'm using worksheet protection IWorksheet.ProtectContents. If i try to change something there is message: "Locked cells cannot be modified when protection is enabled". So is there a way to change text and title of this message or though hide it?

Was it helpful?

Solution

You can handle the WorkbookView.ShowError(...) event, which would give you the chance to prevent certain error messages from popping up or provide your own custom message. Example:

private void workbookView_ShowError(object sender, SpreadsheetGear.Windows.Controls.ShowErrorEventArgs e)
{
    if (e.Message == "Locked cells cannot be modified when protection is enabled.")
    {
        MessageBox.Show("My custom message");
        e.Handled = true;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top