private void txtPerson_TextChanged(object sender, EventArgs e) { try { DateTime day = CommonUntil.mustFinish(dateStart.Value.Date, dateEnd.Value.Date, this.plan_person, txtPerson.Text); dateMustFinish.Value = day; } catch { // } }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { try { int person = Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells["person"].Value.ToString()); DateTime dateStart = DateTime.ParseExact(dataGridView1.Rows[e.RowIndex].Cells["re_plan_date_start"].Value.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture); DateTime dateEnd = DateTime.ParseExact(dataGridView1.Rows[e.RowIndex].Cells["re_plan_date_end"].Value.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture); object plan_person = dataGridView1.Rows[e.RowIndex].Cells["plan_person"].Value; DateTime day = CommonUntil.mustFinish(dateStart, dateEnd, plan_person, person); dataGridView1.Rows[e.RowIndex].Cells["must_date_finish"].Value = day.ToString("dd-MM-yyyy");; } catch { // } }