private void btnAdd_Click(object sender, EventArgs e) { AddEditForm form = new AddEditForm(); form.OnInsert += Form_OnInsert; form.Show(); }
private void btnEdit_Click(object sender, EventArgs e) { Product product = new Product(); product.name = dgvProducts.CurrentRow.Cells[0].Value.ToString(); product.brand = dgvProducts.CurrentRow.Cells[1].Value.ToString(); product.price = int.Parse(dgvProducts.CurrentRow.Cells[2].Value.ToString()); product.des = dgvProducts.CurrentRow.Cells[3].Value.ToString(); product.available = bool.Parse(dgvProducts.CurrentRow.Cells[4].Value.ToString()); AddEditForm form = new AddEditForm(product); form.OnUpdate += Form_OnUpdate;; form.Show(); }