private void BtAdd_Click(object sender, EventArgs e) { InputCoffeeForm inForm = new InputCoffeeForm(); if (inForm.ShowDialog() == DialogResult.OK) { dgv.Rows.Add(Coffee.CoffeeToRow(inForm.coffee, dgv)); } inForm.Dispose(); }
private void ChangeRow(DataGridViewRow row) { InputCoffeeForm inForm = new InputCoffeeForm(Coffee.RowToCoffee(row)); inForm.EditOrFind(); if (inForm.DialogResult == DialogResult.OK) { int index = row.Index; dgv.Rows.RemoveAt(index); dgv.Rows.Insert(index, Coffee.CoffeeToRow(inForm.coffee, dgv)); RefreshIndex(); } inForm.Dispose(); }