private void metroButtonSpecialtyEdit_Click(object sender, EventArgs e) { try { string scode = dataGridViewSpecialty.SelectedCells[0].Value.ToString(); if (String.IsNullOrEmpty(scode)) { throw new Exception("Не выделено поле, которое нужно изменить!"); } var specialty = db.Specialties.SingleOrDefault(s => s.SpecialtyCode == scode); SpecialtyEntityForm form = new SpecialtyEntityForm(); form.Text = "Изменение специальности"; form.btnEditvisible = true; form.SpecialtyId = specialty.SpecialtyId; form.sname = specialty.SpecialtyName; form.scode = specialty.SpecialtyCode; form.stime = specialty.SpecialtyTime; form.sform = specialty.SpecialtyFormStudy; form.Show(); } catch (Exception gg) { MessageBox.Show(gg.Message, "Ошибка"); } }
private void metroButtonSpecialtyAdd_Click(object sender, EventArgs e) { SpecialtyEntityForm form = new SpecialtyEntityForm(); form.Text = "Добавление специальности"; form.btnAddvisible = true; form.Show(); }