// On "More settings" button click private void moreSettingsButton_Click(object sender, System.EventArgs e) { var settingsDlg = new SettingsDialog(); // init the dialog settingsDlg.MaxInitialTreeLevel = GPTreeChromosome.MaxInitialLevel; settingsDlg.MaxTreeLevel = GPTreeChromosome.MaxLevel; settingsDlg.HeadLength = headLength; // show the dialog if (settingsDlg.ShowDialog() == DialogResult.OK) { GPTreeChromosome.MaxInitialLevel = settingsDlg.MaxInitialTreeLevel; GPTreeChromosome.MaxLevel = settingsDlg.MaxTreeLevel; headLength = settingsDlg.HeadLength; } }