private void BtnNew_Click(object sender, EventArgs e) { frmSupplier frm = new frmSupplier(); frm.flag = true; AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.TopLevel = false; frm.Dock = DockStyle.Fill; this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Show(); }
private void BtnModify_Click(object sender, EventArgs e) { if (dgvSearch.SelectedRows.Count > 0) { if (dgvSearch.CurrentRow.Cells[0].Value == null) { frmMessageBoxInvalidData frm3 = new frmMessageBoxInvalidData(); frm3.ShowDialog(); } else { frmSupplier frm = new frmSupplier(); AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.TopLevel = false; frm.Dock = DockStyle.Fill; this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.flag = false; frm.btnDelete.Enabled = true; frm.txtCode.Text = dgvSearch.CurrentRow.Cells[0].Value.ToString(); frm.txtName.Text = dgvSearch.CurrentRow.Cells[1].Value.ToString(); frm.txtRuc.Text = dgvSearch.CurrentRow.Cells[2].Value.ToString(); frm.txtAddress.Text = dgvSearch.CurrentRow.Cells[3].Value.ToString(); //Los combo box se rellenan diferente asi no //frm.cboCity.SelectedValue = dgvSearch.CurrentRow.Cells[4].Value.ToString(); //frm.cboCountry.SelectedValue = dgvSearch.CurrentRow.Cells[5].Value.ToString(); frm.txtPhone.Text = dgvSearch.CurrentRow.Cells[5].Value.ToString(); frm.txtEmail.Text = dgvSearch.CurrentRow.Cells[6].Value.ToString(); frm.cboCountry.Enabled = false; frm.cboCity.Enabled = false; frm.Show(); } } else { frmMessageBoxSelectRow frm2 = new frmMessageBoxSelectRow(); frm2.ShowDialog(); } }