Validating a date in a DateTimePicker
-
this is what i need to do: user enters a date in the DateTimePicker. the code needs to validate the date agains a few criterias. if it does not pass the validation. display a message asking if the user really wants that date. if the user wants to continue with the date, just go ahead. if not the date should go back to what it was. I am having the hardest time to get the program to flow thist way. I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work. Can any one help! thank you tephra:confused:
-
this is what i need to do: user enters a date in the DateTimePicker. the code needs to validate the date agains a few criterias. if it does not pass the validation. display a message asking if the user really wants that date. if the user wants to continue with the date, just go ahead. if not the date should go back to what it was. I am having the hardest time to get the program to flow thist way. I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work. Can any one help! thank you tephra:confused:
Use the TextChanged event Darryl Borden Principal IT Analyst dborden@eprod.com
-
this is what i need to do: user enters a date in the DateTimePicker. the code needs to validate the date agains a few criterias. if it does not pass the validation. display a message asking if the user really wants that date. if the user wants to continue with the date, just go ahead. if not the date should go back to what it was. I am having the hardest time to get the program to flow thist way. I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work. Can any one help! thank you tephra:confused:
-
this is what i need to do: user enters a date in the DateTimePicker. the code needs to validate the date agains a few criterias. if it does not pass the validation. display a message asking if the user really wants that date. if the user wants to continue with the date, just go ahead. if not the date should go back to what it was. I am having the hardest time to get the program to flow thist way. I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work. Can any one help! thank you tephra:confused:
The problem with the validating event is the messagebox. the messagebox kicks the "valuechanged" event. even if i disable the event before the messagebox, the value already changed and the event is not kicked afterwards when i want to. also there is the path that does not go through the messagebox(when the date is valid). and so on... I keep getting caught on something. it would be simpler if i could get the messagebox to stop changing the value of the datetimepicker before the validating is finished. thank you
-
The problem with the validating event is the messagebox. the messagebox kicks the "valuechanged" event. even if i disable the event before the messagebox, the value already changed and the event is not kicked afterwards when i want to. also there is the path that does not go through the messagebox(when the date is valid). and so on... I keep getting caught on something. it would be simpler if i could get the messagebox to stop changing the value of the datetimepicker before the validating is finished. thank you