doraemon Posted January 5, 2006 Posted January 5, 2006 I am using a datetimepicker for the users to enter dates. I have the "ShowCheckBox" to be true so that if there is no date to be entered, the check box would be uncheckd. I came across with a problem. When the form is cleared, the user would like to have the date resetted to the current date. However, after I set the value to the current date, the check box is automatcially checked for me. I even have a line of code setting the Checked property to False right afterward but the box would still be checked. Is there soemthing I've done wrong? Right now I'm just forced to leave with the existing value and just set the Checked property to False. But the user would prefer to have it reset. Any suggestion? Quote
EFileTahi-A Posted January 18, 2006 Posted January 18, 2006 How is data being cleared? Through a button or something? Could post the project or some of your code? Quote
Cags Posted January 18, 2006 Posted January 18, 2006 I tried using the following... dateTimePicker1.ResetText(); dateTimePicker1.Checked = false; and it worked fine. It both reset the date and unchecked the box. Quote Anybody looking for a graduate programmer (Midlands, England)?
EFileTahi-A Posted January 27, 2006 Posted January 27, 2006 Ok, can you upload your project? I'll look into it. Quote
doraemon Posted February 7, 2006 Author Posted February 7, 2006 I tried the code (using VB equivalent). One thing funny I noticed was that if the datetimepicker was not checked and after running these 2 lines of codes, the check mark would be on. So, I have to add a condition to see if the datetimepicker is checked and if so the 2 lines would be executed; otherwise, nothing would happen. It is really weird that such a condition is put in. I don't know if it's a bug on the control. I tried using the following... dateTimePicker1.ResetText(); dateTimePicker1.Checked = false; and it worked fine. It both reset the date and unchecked the box. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.