Example #1
0
 private void showButton_Click(object sender, EventArgs e)
 {
     if (productsListBox.SelectedItem != null)
     {
         Product     product     = products[productsListBox.SelectedIndex];
         ProductForm productForm = new ProductForm(product, "OK", false);
         productForm.ShowDialog();
     }
 }
Example #2
0
        private void addButton_Click(object sender, EventArgs e)
        {
            Product     product     = new Product();
            ProductForm productForm = new ProductForm(product, "Add");

            if (productForm.ShowDialog() == DialogResult.OK)
            {
                products.Add(product);
                productsListBox.Items.Add(String.Format("{0,-15}\t{1,-15}\t{2,-4} pc.\t{3,-4} uah", product.Name, product.Country, product.Quantity, product.Price));
                Count++;
            }
        }
Example #3
0
 private void editButton_Click(object sender, EventArgs e)
 {
     if (productsListBox.SelectedItem != null)
     {
         Product     product     = products[productsListBox.SelectedIndex];
         ProductForm productForm = new ProductForm(product, "Edit");
         if (productForm.ShowDialog() == DialogResult.OK)
         {
             products[productsListBox.SelectedIndex] = product;
             productsListBox.Items[productsListBox.SelectedIndex] = String.Format("{0,-15}\t{1,-15}\t{2,-4} pc.\t{3,-4} uah", product.Name, product.Country, product.Quantity, product.Price);
         }
     }
 }