private void btnEditar_Click(object sender, EventArgs e) { if (GridFacturas.SelectedRows.Count > 0) { FormMantFactura hijo = new FormMantFactura(); AddOwnedForm(hijo); hijo.IsInsert = false; hijo.FormBorderStyle = FormBorderStyle.None; hijo.TopLevel = false; hijo.Dock = DockStyle.Fill; hijo.Top = (this.Height / 2) - (hijo.Height / 2); hijo.Left = (this.Width / 2) - (hijo.Width / 2); hijo.FormClosed += new FormClosedEventHandler(Form_Closed); hijo.ControlBox = false; this.Controls.Add(hijo); this.Tag = hijo; hijo.BringToFront(); hijo.txtid.Text = GridFacturas.CurrentRow.Cells[0].Value.ToString(); hijo.txtIdCliente.Text = GridFacturas.CurrentRow.Cells[3].Value.ToString(); hijo.fecha.Value = DateTime.Parse(GridFacturas.CurrentRow.Cells[1].Value.ToString()); hijo.Show(); } else { MessageBox.Show("seleccione una fila por favor"); } }
private void btnNuevo_Click(object sender, EventArgs e) { FormMantFactura hijo = new FormMantFactura(); AddOwnedForm(hijo); hijo.IsInsert = true; hijo.FormBorderStyle = FormBorderStyle.None; hijo.TopLevel = false; hijo.Dock = DockStyle.Fill; hijo.Top = (this.Height / 2) - (hijo.Height / 2); hijo.Left = (this.Width / 2) - (hijo.Width / 2); hijo.FormClosed += new FormClosedEventHandler(Form_Closed); hijo.ControlBox = false; this.Controls.Add(hijo); this.Tag = hijo; hijo.BringToFront(); hijo.Show(); }