grdEmployees.Rows.Clear(); objGet = new GetClass(); DataTable dt = objGet.GetValues("GetVacationForStartWork", txtEmployeeCode.Text.Trim()); for (Int32 i = 0; i < dt.Rows.Count; i++) { grdEmployees.Rows.Add(Convert.ToDateTime(dt.Rows[i]["StartDate"]).ToString("MM/dd/yyyy") , Convert.ToDateTime(dt.Rows[i]["EndDate"]).ToString("MM/dd/yyyy"), dt.Rows[i]["IDVacation"] ); } foreach (DataGridViewRow row in grdEmployees.Rows) { for (Int32 i = 0; i < dt.Rows.Count; i++) { try { row.Cells["WorkStart"].Value = Convert.ToDateTime(row.Cells["EndDate"].Value).AddDays(1); row.Cells["ConfirmedWorkStarted"].Value = Convert.ToDateTime(dt.Rows[i]["ConfirmedWorkStarted"]); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
StartDate EndDate IDVacation ConfirmedWorkStarted 2015-06-06 2015-06-26 19 6/30/2015 12:00:00 AM 2015-07-20 2015-07-25 18 7/27/2015 12:00:00 AM
StartDate EndDate IDVacation ConfirmedWorkStarted 2015-06-06 2015-06-26 19 7/27/2015 2015-07-20 2015-07-25 18 7/27/2015
row.Cells["ConfirmedWorkStarted"].Value = Convert.ToDateTime(dt.Rows[i]["ConfirmedWorkStarted"]);
row.Cells["ConfirmedWorkStarted"].Value = Convert.ToDateTime(row.Cells["ConfirmedWorkStarted"])
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)