Пример #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            SubForm productForm = new SubForm();

            if (productForm.ShowDialog() == DialogResult.OK)
            {
                Product prod = productForm.GetProduct();
                products.Add(prod);
            }
        }
Пример #2
0
 private void EditButton_Click(object sender, EventArgs e)
 {
     if (itemsListBox.SelectedIndex != -1)
     {
         Product editProd    = itemsListBox.SelectedItem as Product;
         SubForm productForm = new SubForm();
         productForm.SetProduct(editProd);
         if (productForm.ShowDialog() == DialogResult.OK)
         {
             products.Remove(editProd);
             products.Add(productForm.GetProduct());
         }
     }
 }