Note that there are some explanatory texts on larger screens.

plurals
  1. PODateTimePicker is not working Properly
    primarykey
    data
    text
    <p>Actually , I have 2 dateTimePicker in my form in c sharp dot net 2008.Both of them perform same event.But One of them is not working Properly until i use another one.Please Help me OUT!!!!</p> <pre><code> private void dtpStart_ValueChanged(object sender, EventArgs e) { if (cmbDay.SelectedIndex == -1 || cmbLeaveName.SelectedIndex == -1) { MessageBox.Show("Please select Day and Leave Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dtpStart.ValueChanged -= new EventHandler(dtpStart_ValueChanged); } if (dtpStart.Value &gt; dtpEnd.Value) { MessageBox.Show("The End date of leave cannot be occur before date of leave ", "Invalid Entry", MessageBoxButtons.OK); dtpStart.Value = dtpEnd.Value; } getdays(); check = validate(); if (check == "Incorrect") { check = "Correct"; return; } LoadDataGridView(); } private void dtpEnd_ValueChanged(object sender, EventArgs e) { if (cmbDay.SelectedIndex == -1 || cmbLeaveName.SelectedIndex == -1) { MessageBox.Show("Please select Day and Leave Name","Error",MessageBoxButtons.OK,MessageBoxIcon.Exclamation); dtpEnd.ValueChanged -= new EventHandler(dtpEnd_ValueChanged); return; } if (dtpEnd.Value &lt; dtpStart.Value) { MessageBox.Show("The End date of leave cannot be occur before date of leave ", "Invalid Entry", MessageBoxButtons.OK); dtpEnd.Value = dtpStart.Value; } getdays(); check = validate(); if (check == "Incorrect") { check = "Correct"; return; } LoadDataGridView(); } private void getdays() { double ts = GetDateDifference(); if (cmbDay.Text.ToString() == "Full Day") { txtLeaveApplied.Text = ts.ToString(); } else if (cmbDay.Text.ToString() == "Half Day") { txtLeaveApplied.Text = ((float.Parse(ts.ToString())) / 2).ToString(); } } private string validate() { string Name = cmbApplicantName.Text.ToString(); string EMP_ID = GetEmpId(Name); DataTable dtvalidate = new DataTable(); dtvalidate = LI.ValidateLeaveInfo(EMP_ID, DateTime.Parse(dtpStart.Value.ToShortDateString()), DateTime.Parse(dtpEnd.Value.ToShortDateString())); if (dtvalidate.Rows.Count &gt; 0) { StringBuilder date = new StringBuilder(); foreach (DataRow row in dtvalidate.Rows) { date.Append(row["Leave_Date"].ToString() + Environment.NewLine); } MessageBox.Show("Leave Already applied in following Date(s)" + Environment.NewLine + date, "Select valid date", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); check = "Incorrect"; dgvLeaveApplication.Rows.Clear(); } dtvalidate.Rows.Clear(); dtvalidate.Dispose(); return check; } private void LoadDataGridView() { double ts = GetDateDifference(); dgvLeaveApplication.Rows.Clear(); DateTime dt = DateTime.Parse(dtpStart.Value.ToShortDateString()); for (int i = 0; i &lt; Convert.ToInt32(ts.ToString()); i++) { dgvLeaveApplication.Rows.Add(dgvLeaveApplication.Rows.Count, dt.ToShortDateString(), cmbLeaveName.SelectedValue.ToString()); dt = dt.AddDays(1); } dgvLeaveApplication.Refresh(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload