private void preferencesToolStripMenuItem_Click(object sender, EventArgs e) { preferencesForm preferencesForm = new preferencesForm(this, preferencesFile); DialogResult result = preferencesForm.ShowDialog(); if (result == DialogResult.OK) { preferencesForm.preferences.WriteXml(preferencesFile); } preferencesForm.Dispose(); loadPreferences(); setMysqlConnection(); }