private void btnAdd_Click(object sender, EventArgs e) { EditTripForm fm = new EditTripForm(new TripRecord(), true); if (fm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FillGrid(); } }
private void btnEdit_Click(object sender, EventArgs e) { TripRecord trip = new TripRecord(); trip.userID = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); trip.name = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); trip.arriveTime = Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells[2].Value.ToString()); trip.memo = dataGridView1.SelectedRows[0].Cells[3].Value.ToString(); EditTripForm fm = new EditTripForm(trip, false); if (fm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FillGrid(); } }