private void Button1_Click(object sender, EventArgs e) { try { Goods newGoods = new Goods { Name = textBox1.Text, Country = textBox2.Text, Price = Double.Parse(textBox3.Text) }; if (_goods == null) { _parrentList.AddGoods(newGoods); } else { _parrentList.EditGoods(newGoods); } this.Close(); } catch (Exception exp) { MessageBox.Show(exp.Message + " : Имя и страна товара не должны быть пустыми, цена >= 0", "Ошибка редактирования товара", MessageBoxButtons.OK, MessageBoxIcon.Error); } }