private void button1_Click(object sender, EventArgs e) { try { Met11 m = new Met11(); string[] str = comboBox1.Items[comboBox1.SelectedIndex].ToString().Split(new char[] { ' ' }); m.Delete(Convert.ToInt32(str[0])); this.Close(); } catch { MessageBox.Show("Error"); } }
private void button1_Click(object sender, EventArgs e) { try { Met15 m = new Met15(); Met11 m2 = new Met11(); string[] str = comboBox1.Items[comboBox1.SelectedIndex].ToString().Split(new char[] { ' ' }); m.Delete(Convert.ToInt32(str[0])); var ec2 = from n2 in db11.Raspisanie where n2.IDVrem == Convert.ToInt32(str[0]) select n2; foreach (var i in ec2) { m2.Delete(i.ID); } this.Close(); } catch { MessageBox.Show("Error"); } }