private void button1_Click(object sender, EventArgs e) { try { Met9 m = new Met9(); m.Delete(comboBox1.Items[comboBox1.SelectedIndex].ToString()); this.Close(); } catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Met9 d = new Met9(); var ec = from n2 in db10.Postavshik where n2.Name == comboBox2.Items[comboBox2.SelectedIndex].ToString() select n2; foreach (var i in ec) { temp = i.ID; } d.Edit(Convert.ToInt32(comboBox1.Items[comboBox1.SelectedIndex]), textBox1.Text, Convert.ToInt32(textBox2.Text), temp, textBox3.Text); this.Close(); } catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); } catch { MessageBox.Show("Error"); } }