Hi Priya,
You can do it in a simple way.
Make a method like this.
private void UnCheckedControl()
{
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
checkBox4.Checked = false;
checkBox5.Checked = false;
checkBox6.Checked = false;
checkBox7.Checked = false;
}
place following code under your dateTimePicker1_ValueChanged event and run the application. Hope this will solve your issue. There are other complex ways to solve this issue.
DateTime dt = dateTimePicker1.Value;
if (dt.DayOfWeek.ToString() == "Monday")
{
UnCheckedControl();
checkBox1.Checked= true;
}
else if (dt.DayOfWeek.ToString() == "Tuesday")
{
UnCheckedControl();
checkBox2.Checked = true;
}
else if (dt.DayOfWeek.ToString() == "Wednesday")
{
UnCheckedControl();
checkBox3.Checked = true;
}
else if (dt.DayOfWeek.ToString() == "Thursday")
{
UnCheckedControl();
checkBox4.Checked = true;
}
else if (dt.DayOfWeek.ToString() == "Friday")
{
UnCheckedControl();
checkBox5.Checked = true;
}
else if (dt.DayOfWeek.ToString() == "Saturday")
{
UnCheckedControl();
checkBox6.Checked = true;
}
else if (dt.DayOfWeek.ToString() == "Sunday")
{
UnCheckedControl();
checkBox7.Checked = true;
}
Enter your message below
Sign in or Join us (it's free).