private void btnAdd_Click(object sender, EventArgs e) { AddEditForm form = new AddEditForm(); form.OnInsert += Form_OnInsert; form.Show(); }
private void btnAddGoods_Click(object sender, EventArgs e) { AddEditForm addForm = new AddEditForm(null); if (addForm.ShowDialog() == DialogResult.OK) { } }
/// <summary> /// Otwarcie formularza dla dodawania obiektu /// </summary> /// <param name="formDataSource"></param> /// <returns></returns> public object OpenAddForm(object formDataSource) { AddEditForm addEditForm = new AddEditForm(); addEditForm.DataSource = formDataSource; addEditForm.ShowDialog(); return(null); }
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(); }