private void btnRemove_Click(object sender, EventArgs e) { if (ctdbgThemes.Row >= 0 && ctdbgThemes.Row < ctdbgThemes.Rows.Count) { string theme = (string)ctdbgThemes.Rows[ctdbgThemes.Row][0]; try { C1ThemeController.UnregisterTheme(theme); ctdbgThemes.Rows.RemoveAt(ctdbgThemes.Row); } catch (Exception ex) { MessageBox.Show(string.Format("Cannot remove theme, error:\r\n{0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }