IN y application, i have a date shown in textbox control which is extract from database(previously saved in MM/dd/yyyy format).Now i have to compare that date with another date that user inputs from datetimepicker control(custom format MM/dd/yyyy).Now i have to compare this two date and throw some message accordingly after comparision.
my code is like below, which gives error as "String was not
recognized as a valid DateTime."
string textdate1 = textbox1.text;
string textdate2 = datetimepicker1.text;
System.DateTime d1 = System.DateTime.Parse(textdate1);
System.DateTime d2 = System.DateTime.Parse(textdate2);
if (System.DateTime.Compare(d1, d2) < 0)
{
MessageBox.Show("date 2 is later then date 1");
}
can anyone help me for this,its urgent for me.........