Пример #1
0
        private void newToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmProductAdd frm = new frmProductAdd();

            frm.MdiParent   = this;
            frm.WindowState = FormWindowState.Maximized;
            frm.Show();
        }
        //add, update, delete, search
        private void btnAdd_Click(object sender, EventArgs e)
        {
            GlobalVariable.selectedProductID = 0;
            frmProductAdd editForm = new frmProductAdd();

            editForm.ShowDialog();
            lvProducts.Items.Clear();
            DisplayProducts();
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //checks that product has been chosen
            if (lvProducts.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a Product to update");
                return;
            }
            GlobalVariable.selectedProductID = int.Parse(lvProducts.SelectedItems[0].Text);
            frmProductAdd editForm = new frmProductAdd();

            editForm.ShowDialog();
            lvProducts.Items.Clear();
            DisplayProducts();
        }