private void tool_editar_Click(object sender, EventArgs e) { frmEditCategoria mpp = new frmEditCategoria(); DialogResult resul = new DialogResult(); mpp.modificar = true; mpp.txtIdcat.Text = dtgCategoria.CurrentRow.Cells[0].Value.ToString(); mpp.txtcategoria.Text = dtgCategoria.CurrentRow.Cells[1].Value.ToString(); mpp.txtdescripcion.Text = dtgCategoria.CurrentRow.Cells[2].Value.ToString(); resul = mpp.ShowDialog(); if (mpp.OPTION == "OK") { try { Op.Idcategoria = int.Parse(mpp.txtIdcat.Text); Op.Categoria1 = mpp.txtcategoria.Text; Op.Descripcion = mpp.txtdescripcion.Text; OPLN.ModificarCategoria(Op); MostrarProvedores(); } catch (Exception mes) { MessageBox.Show(mes.Message); } } }
private void tool_nuevo_Click(object sender, EventArgs e) { frmEditCategoria fp = new frmEditCategoria(); DialogResult resul = new DialogResult(); resul = fp.ShowDialog(); if (fp.OPTION == "OK") { try { // Op.IdProveedor = int.Parse(fp.txtId.Text); Op.Categoria1 = fp.txtcategoria.Text; Op.Descripcion = fp.txtdescripcion.Text; OPLN.InsertarCategoria(Op); MostrarProvedores(); } catch (Exception mes) { MessageBox.Show(mes.Message); } } }