{ DateTime dt = Convert.ToDateTime(TextBox1.Text); DateTime dta = Convert.ToDateTime(TextBox2.Text); TimeSpan pp = dta - dt; int days = pp.Days; string s = TextBox1.Text; string t = TextBox2.Text; DateTime theDateA = DateTime.Parse(s); DateTime theDateB = DateTime.Parse(t); if (theDateB > theDateA) { if (days > 31) { TextBox1.BackColor = System.Drawing.Color.Red; TextBox2.BackColor = System.Drawing.Color.Red; date_Error_cell.Text = "Select a DATE NOT more than 31 days"; date_Error_cell.Attributes.Add("style", "font-weight:bold; text-align:center; font-family:Calibri; color:Red; font-size:large;"); Monthly_Spend(); label(); } else { TextBox1.BackColor = System.Drawing.Color.White; TextBox2.BackColor = System.Drawing.Color.White; date_Error_cell.Text = ""; bind_grid(); Monthly_Spend(); } } else { date_Error_cell.Text = "Select a VALID date"; } }
Copy Code(0[1-9]|[12][0-9]|3[01]).(0[1-9]|1[012]).\d{4}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)