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 agregarInstalacion = new Agregar(orden); Tag = "C"; agregarInstalacion.TopLevel = false; agregarInstalacion.Dock = DockStyle.None; Controls.Add(agregarInstalacion); agregarInstalacion.Location = new Point(50, 50); agregarInstalacion.BringToFront(); agregarInstalacion.FormClosed += new FormClosedEventHandler(A_FormClosed); agregarInstalacion.Show(); } } catch (Exception ex) { MessageBox.Show("" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnNew_Click(object sender, EventArgs e) { Agregar agregarInstalacion = new Agregar(null); Tag = "I"; agregarInstalacion.BringToFront(); agregarInstalacion.FormClosed += new FormClosedEventHandler(A_FormClosed); agregarInstalacion.Show(); }