private void BtnAddNomcla_Click(object sender, EventArgs e) { AddNomenclature m = new AddNomenclature(0); try { m.btnAdd.Text = "Add New"; m.ShowDialog(); RefreshNomcla(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnUpNomcla_Click(object sender, EventArgs e) { if (dgvNomenclature.Rows.Count > 0) { var id = Convert.ToInt32(dgvNomenclature.CurrentRow.Cells[0].Value.ToString()); AddNomenclature m = new AddNomenclature(id); m.txtDsg.Text = dgvNomenclature.CurrentRow.Cells[1].Value.ToString(); m.txtNrR.Text = dgvNomenclature.CurrentRow.Cells[2].Value.ToString(); m.txtCond.Text = dgvNomenclature.CurrentRow.Cells[3].Value.ToString(); //m.cmbColr.selectedIndex = m.cmbColr.Items.IndexOf("RED"); m.btnAdd.Text = "Update"; m.ShowDialog(); RefreshNomcla(); } else { MessageBox.Show("There is nothing to Update !!!", "Opration Failed", MessageBoxButtons.OK, icon: MessageBoxIcon.Error); } }