Пример #1
0
        private void lbProducts_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            SetProduct set = new SetProduct(this);

            set.ShowDialog();

            // create object
            Product product = new Product()
            {
                Name = set.tbDescription.Text, Description = set.tbDescription.Text, Price = (int)set.nudPrice.Value
            };

            lbProducts.Items[lbProducts.SelectedIndex] = product;
            if (btnAdd.DialogResult == DialogResult.OK)
            {
                lbProducts.Items.RemoveAt(lbProducts.SelectedIndex);
            }
            //lbProducts.Items[lbProducts.SelectedIndex] = set.tbName;
            //lbProducts.Items[lbProducts.SelectedIndex] = set.tbDescription;
            //lbProducts.Items[lbProducts.SelectedIndex] = set.nudPrice;
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            SetProduct set = new SetProduct(this);

            set.ShowDialog();
        }