private void buttonSave_Click(object sender, EventArgs e) { if (comboBoxCabinet.SelectedIndex >= 0 && comboBoxCorpus.SelectedIndex >= 0 && comboBoxCorpus.SelectedIndex >= 0 && comboBoxDoctor.SelectedIndex >= 0) { ControlFunctions.EditVisit(visit, comboBoxDoctor.Text, comboBoxPatient.Text, comboBoxCorpus.Text, comboBoxCabinet.Text, datePicker.Text, timePicker.Text); this.Close(); } else { MessageBox.Show("Заполните поля"); } }