private void buttonPartAdd_Click(object sender, EventArgs e) { DbParts form = new DbParts(); form.buttonPartAddDb.Visible = true; form.Text = "Добавление запчасти"; form.Show(); }
private void buttonPartEdit_Click(object sender, EventArgs e) { try { DbParts form = new DbParts(); form.buttonPartEditDb.Visible = true; int partid = Convert.ToInt32(dataGridViewParts.SelectedCells[0].Value); var part = db.Parts.Find(partid); form.textBoxPartName.Text = part.PartName; form.textBoxPartUnit.Text = part.PartUnit; form.labelId.Text = part.PartId.ToString(); form.Text = "Редактирование запчасти"; form.Show(); } catch (Exception gg) { MessageBox.Show(gg.Message); } }