Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
  • 2 weeks later...
Posted

I tried using the following...

dateTimePicker1.ResetText();
dateTimePicker1.Checked = false;

 

and it worked fine. It both reset the date and unchecked the box.

Anybody looking for a graduate programmer (Midlands, England)?
  • 2 weeks later...
  • 2 weeks later...
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...