private void List_AfterLabelEdit(object sender, LabelEditEventArgs e) { e.CancelEdit = true; // if this is a successful edit, we will update the label ourselves var lvi = _list.Items[e.Item]; var type = (NotebookItemType)Enum.Parse(typeof(NotebookItemType), lvi.Group.Name); if (e.Label == null) { return; // user did not change the name } // can't delete tables or views if an operation is in progress bool isTableOrView = type == NotebookItemType.Table || type == NotebookItemType.View; if (isTableOrView && _operationInProgress) { MessageForm.ShowError(_mainForm, "Delete Item", "Cannot rename tables or views while an operation is in progress.", "Please wait until the current operation finishes, and then try again."); return; } try { _manager.RenameItem(new NotebookItem(type, lvi.Text), e.Label); } catch (Exception ex) { MessageForm.ShowError(TopLevelControl, "Rename Error", ex.Message); } }