I have two forms and i have retrive controls from one form to another.
In form 1
Two controls
1 datetimepicker1
2 datetimepicker2
in form 2
1 Datetimepicker1
now i retrive form1 controls on form2 and i want to compare form1 datetimepicker with form2 datetimepicker.
here is code:
/
Form2 fr2 = new Form2("", "");
DateTime cdt = dateTimePicker1.Value;
if ((fr2.dateTimePicker1.Value<=cdt) && (fr2.dateTimePicker2.Value>=cdt))
{
MessageBox.Show("This Date Is Not Valid In Current Accounting Year", "Correct Date");
}
else
{
MessageBox.Show("You Can Save");
}
{
but this code not giving me the proper output. it always goes in else condition.
either the form2 datetimepicker1 value not properly change.
but can you solve this problem.