private void btnEditVendors_Click(object sender, EventArgs e) { Form EditVendors = new Edit_Vendors(); EditVendors.ShowDialog(); cmbVendor.DataSource = GeneralMethods.GetVendors(); cmbVendor.SelectedIndex = -1; ProductsData.DataSource = GeneralMethods.GetProducts(); }
private void button1_Click(object sender, EventArgs e) { Form AddProduct = new Add_Product(); //this.Hide(); AddProduct.ShowDialog(); this.Show(); ProductsData.DataSource = GeneralMethods.GetProducts(); }
private void dgvProducts_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int id = Convert.ToInt32(dgvProducts.Rows[dgvProducts.CurrentCell.RowIndex].Cells[0].FormattedValue.ToString()); Form AddProduct = new Add_Product(id); //this.Hide(); AddProduct.ShowDialog(); this.Show(); ProductsData.DataSource = GeneralMethods.GetProducts(); }
private void btnEditCategories_Click(object sender, EventArgs e) { Form EditCategories = new Edit_Categories(); //this.Hide(); EditCategories.ShowDialog(); cmbCategory.DataSource = GeneralMethods.GetCategories(); cmbCategory.SelectedIndex = -1; ProductsData.DataSource = GeneralMethods.GetProducts(); //this.Show(); }
private void dgvProducts_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { if ((MessageBox.Show("Are you sure you wish to delete the selected product data?", "Confirm", MessageBoxButtons.YesNo)) == DialogResult.Yes) { int id = Convert.ToInt32(dgvProducts.Rows[dgvProducts.CurrentCell.RowIndex].Cells[0].FormattedValue.ToString()); GeneralMethods.DeleteProduct(id); MessageBox.Show("The data has been deleted successfully!", "Success"); ProductsData.DataSource = GeneralMethods.GetProducts(); } } }
public Products() { InitializeComponent(); ProductsData.DataSource = GeneralMethods.GetProducts(); dgvProducts.DataSource = ProductsData; dgvProducts.ClearSelection(); cmbVendor.DataSource = GeneralMethods.GetVendors(); cmbVendor.DisplayMember = "vname"; cmbVendor.SelectedIndex = -1; cmbCategory.DataSource = GeneralMethods.GetCategories(); cmbCategory.DisplayMember = "catname"; cmbCategory.SelectedIndex = -1; }