private void BtnAddTool_Click(object sender, EventArgs e) { frmTool frm = new frmTool(); if (dgvSearch.SelectedRows.Count > 0) { if (dgvSearch.CurrentRow.Cells[0].Value == null) { frmMessageBoxInvalidData frm3 = new frmMessageBoxInvalidData(); frm3.ShowDialog(); } else { frm.flag = 2; frm.cboCategory.Enabled = false; frm.cboFamily.Enabled = false; frm.cboBrand.Enabled = false; frm.cboStorehouse.Enabled = false; frm.cboSupplier.Enabled = false; frm.cboMoney.Enabled = false; frm.cboWayofPay.Enabled = false; frm.txtName.Enabled = false; frm.txtPrice.Enabled = false; frm.txtCode.Enabled = true; frm.txtSerie.Enabled = true; frm.txtId.Enabled = false; OpenFormPanel(frm); } } else { frmMessageBoxSelectRow frm2 = new frmMessageBoxSelectRow(); frm2.ShowDialog(); } }
private void BtnNew_Click(object sender, EventArgs e) { frmTool frm = new frmTool(); frm.cboCategory.Enabled = true; frm.cboFamily.Enabled = true; frm.cboBrand.Enabled = true; frm.cboStorehouse.Enabled = true; frm.cboSupplier.Enabled = true; frm.cboMoney.Enabled = true; frm.cboWayofPay.Enabled = true; frm.txtName.Enabled = true; frm.txtPrice.Enabled = true; frm.txtCode.Enabled = false; frm.txtSerie.Enabled = false; frm.txtId.Enabled = false; frm.btnDataG.Enabled = true; frm.btnSave.Enabled = false; btnAddTool.Enabled = true; frm.flag = 1; AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.TopLevel = false; frm.Dock = DockStyle.Fill; this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Show(); }