private void AbrirFormularioAgregar(DataGridViewCellEventArgs row, DataGridView view) { try { if (row.RowIndex >= 0) { CEOrden orden = new CEOrden { id = Convert.ToInt32(view.Rows[row.RowIndex].Cells[0].Value), numero = view.Rows[row.RowIndex].Cells[1].Value.ToString(), proveedorDocumento = view.Rows[row.RowIndex].Cells[2].Value.ToString(), proveedorNombreCorto = view.Rows[row.RowIndex].Cells[3].Value.ToString(), fecha = view.Rows[row.RowIndex].Cells[4].Value.ToString(), anulado = Convert.ToBoolean(view.Rows[row.RowIndex].Cells[5].Value), observacion = view.Rows[row.RowIndex].Cells[6].Value.ToString() }; Agregar agregarRecogida = new Agregar(orden); Tag = "C"; agregarRecogida.TopLevel = false; agregarRecogida.Dock = DockStyle.None; Controls.Add(agregarRecogida); agregarRecogida.Location = new Point(50, 50); agregarRecogida.BringToFront(); agregarRecogida.FormClosed += new FormClosedEventHandler(A_FormClosed); agregarRecogida.Show(); } } catch (Exception ex) { MessageBox.Show("" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnNew_Click(object sender, EventArgs e) { Agregar agregarRecogida = new Agregar(null); Tag = "I"; agregarRecogida.BringToFront(); agregarRecogida.FormClosed += new FormClosedEventHandler(A_FormClosed); agregarRecogida.Show(); }