Example #1
0
        private void btnBorrar_Click(object sender, EventArgs e)
        {
            Int32 indice = this.dgvGrilla.CurrentRow.Index;

            Producto p = new Producto(int.Parse(this._dtProductos.Rows[indice]["IdProducto"].ToString()), this._dtProductos.Rows[indice]["Descripcion"].ToString());

            frmABM frm = new frmABM(p);

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this._dtProductos.Rows[indice].Delete();

                CargarGrilla();
            }
        }
Example #2
0
        private void btnAlta_Click(object sender, EventArgs e)
        {
            frmABM frm = new frmABM();

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DataRow fila = this._dtProductos.NewRow();
                fila["IdProducto"]  = frm.ProductoDelFormulario.IdProducto;
                fila["Descripcion"] = frm.ProductoDelFormulario.Descripcion;

                this._dtProductos.Rows.Add(fila);

                CargarGrilla();
            }
        }