private void CreateIndexes(bool full) { IList <ForeignKeyMissingIndexes> missingIndexes = GetSelectedForeignKeys(); string createIndexes = Optimizer.CreateIndexesForeignKey(missingIndexes, full); MessageBoxWithTextBox form = new MessageBoxWithTextBox(this, createIndexes, "Creating indexes", "Create indexes"); if (form.ShowDialog(this) == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; try { Database.Instance.ExecuteNonResultQuery(form.richTextBoxText.Text); MessageBox.Show(this, "Creating indexes was successful.", "Creating indexes", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exc) { Debug.WriteLine(exc); MessageBox.Show(this, "Creating indexes failed with this error: " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } ForeignKeyWithoutIndexes_Load(this, null); Cursor.Current = Cursors.Default; } }