private void buttonSaveNew_Click(object sender, EventArgs e) { string name = FormStringRequest.GetString("Введите название профиля"); if (name != null) { MeasureProfile prof = collectProfile(name); Program.DataProvider.insertMeasureProfile(prof); fillProfiles(-1); comboBoxProfiles.SelectedIndex = comboBoxProfiles.Items.Count - 1; } }
public static string GetString(string caption) { if (form == null || form.IsDisposed) { form = new FormStringRequest(); } form.textBox1.Text = ""; form.Text = caption; if (form.ShowDialog() == DialogResult.OK) { return(form.textBox1.Text); } else { return(null); } }