Exemplo n.º 1
0
        //Button add new supplier.
        private void buttonAddSupplier_Click(object sender, EventArgs e)
        {
            //Make new Supplier object.
            Supplier addSupplier = new Supplier();

            //Make new SupplierAddOrEditForm object and pass a new Supplier object to the form.
            SupplierAddOrEditForm SupplierAddOrEditForm = new SupplierAddOrEditForm(addSupplier);

            SupplierAddOrEditForm.FormClosed += Form1_Load;
            SupplierAddOrEditForm.Show();
        }
Exemplo n.º 2
0
        //Button edit Supplier.
        private void button3EditSupplier_Click(object sender, EventArgs e)
        {
            if (comboBoxMainEditSupplier.SelectedItem != null)
            {
                //Find selected Supplier and add it to the Supplier Object.
                Supplier addSupplier = Program.db.Suppliers.Find(comboBoxMainEditSupplier.SelectedValue);

                //Make new SupplierAddOrEditForm object and pass the selected Supplier object to the form.
                SupplierAddOrEditForm SupplierAddOrEditForm = new SupplierAddOrEditForm(addSupplier);
                SupplierAddOrEditForm.FormClosed += Form1_Load;
                SupplierAddOrEditForm.Show();
            }

            //Clears datasource.
            comboBoxMainEditSupplier.DataSource = null;
            //Rerun method Dictionary to refresh comboboxes and listview.
            Dictionary();
        }