hi friends,
i am doing application for leave approval in my SAVE button i have wrote code like this
if (dtpToDate.Text =="")
{
errorMsg("Please Enter The todate");
dtpToDate.Focus();
}
when i click save button without selecting todate it have show message please enter the todate but the current date is aromatically storing in date base because when i run the application the current date is displaying in datetimepicker so when i click my save button date is storing. How i can i show message .
could anyone help me
thanks
Loading
EhteshamPosted Aug 9, 2012, 5:32 AM
DateTime SelectedDate;
string Format = "dd/MM/yyyy";
if (DateTime.TryParseExact("12/12/2012", Format, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out SelectedDate))
{
//date is valid, get the date value from SelectedDate
}
else
{
//Not selected/not valid
}
Ashok KumarPosted Aug 9, 2012, 3:04 AM
datetime SelectedDate;
else if (DateTime.TryParse(dtpToDate.Text, out SelectedDate))
// else if (dtpToDate.Text =="")
{
errorMsg("Please Enter The todate");
dtpToDate.Focus();
}
EhteshamPosted Aug 9, 2012, 2:33 AM
if (DateTime.TryParse(dtpToDate.Text, out SelectedDate))
{
//date is selected, get the date value from SelectedDate
}
else
{
//Not selected/not valid
}