private void button2_Nalichie_Click(object sender, EventArgs e) { Tovar tovar = new Tovar(); Form2_Sales A = new Form2_Sales(tovar, true); if (A.ShowDialog() == DialogResult.OK) { listTovar.Add(tovar); this.comboBox1_Nalichie.Items.Add(tovar.Name); } }
public Form2_Sales(Tovar tovar, bool flag) { InitializeComponent(); this.tovar = tovar; this.newTovar = flag; if (!flag) { this.button1_ok.Text = "Заменить"; this.textBox1_Model.Text = this.tovar.Name; this.textBox2_Opisanie.Text = this.tovar.Opisanie; this.textBox1_Prise.Text = this.tovar.Prise.ToString(); } else { this.textBox1_Model.Text = null; this.textBox2_Opisanie.Text = null; this.textBox1_Prise.Text = null; } }