private void BtnChange_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count != 1) { MessageBox.Show("Выберите одну строку"); return; } var selectedId = this.dataGridView1.SelectedRows[0].Cells["Id"].Value; Order selected = db.Orders.Find(selectedId); OrderDetailForm change = new OrderDetailForm(this.db, selected); change.Show(); }
private void BtnAdd_Click(object sender, EventArgs e) { OrderDetailForm add = new OrderDetailForm(this.db); add.Show(); }