private void btnAggiungiMovimento_Click(object sender, EventArgs e) { Movimento m = new Movimento(); FMovimento fm = new FMovimento(m); fm.ShowDialog(); if (fm.DialogResult == DialogResult.OK) { m.Id = counter++; movimenti.Add(m); Aggiorna(); } }
private void gridmov_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } long id = (long)gridmov["Id", e.RowIndex].Value; var m = movimenti.First(mv => mv.Id == id); FMovimento fm = new FMovimento(m); fm.ShowDialog(this); if (fm.DialogResult == DialogResult.OK) { movimenti[e.RowIndex] = m; Aggiorna(); } gridmov.ClearSelection(); }