Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        private void Button3_Redaktirovat_Click(object sender, EventArgs e)
        {
            if (this.comboBox1_Nalichie.SelectedIndex == -1)
            {
                MessageBox.Show("Не выбран товар!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Form2_Sales A     = new Form2_Sales(this.listTovar[this.comboBox1_Nalichie.SelectedIndex], false);
            int         index = this.comboBox1_Nalichie.SelectedIndex;

            if (A.ShowDialog() == DialogResult.OK)
            {
                this.comboBox1_Nalichie.Items.RemoveAt(index);
                this.comboBox1_Nalichie.Items.Insert(index, this.listTovar[index].Name);
                this.comboBox1_Nalichie.SelectedIndex = index;
            }
        }