By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,239 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,239 IT Pros & Developers. It's quick & easy.

DateTimePickers.Checked Problems

P: n/a
Is it just me or does the Checked property of the DateTimePickers not work
properly?
I was trying to set it to off (which should disable the editing of the
control) to indicate that its a null value.
However sometimes when I do set it to off the control doesn't change. If
you read back the value it will say thats its not checked but the controls
is still checked and you can edit the values.
I can't even see a patern to when it decides to do it. Does anyone have an
explanaition for this and hopefully a work around? Thanks for any help.

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
* "Marco Castro" <ma**************@benlan.com> scripsit:
Is it just me or does the Checked property of the DateTimePickers not work
properly?
I was trying to set it to off (which should disable the editing of the
control) to indicate that its a null value.
However sometimes when I do set it to off the control doesn't change. If
you read back the value it will say thats its not checked but the controls
is still checked and you can edit the values.
I can't even see a patern to when it decides to do it. Does anyone have an
explanaition for this and hopefully a work around?


I have heard about this problem several times. Maybe calling the
control's 'Update' method (or something like that) will fix the problem.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Marco,

The datetime picker control does behave differently in one aspect from VB6,
which I believe is bug. Assuming you set the value of the control on form
initialization, I have found that the first change event is not fired when
the user clicks the check box.

As a work around on form initialization I have found it necessary to
initialize the value and the checked status of the DTP control (in this
order) and then set the actual values, for instance:

Me.dtpStartDate.Value = Now()
Me.dtpStartDate.Checked = False

.... set the appropriate values

You must understand that un-checking the control does NOT (a) disable the
control (b) set the value to null. Un-Checking the control only makes the
control appear to be disabled, further clicking or drop down of the picker
will automatically enable the control.

Regards,
Dan
"Marco Castro" <ma**************@benlan.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Is it just me or does the Checked property of the DateTimePickers not work
properly?
I was trying to set it to off (which should disable the editing of the
control) to indicate that its a null value.
However sometimes when I do set it to off the control doesn't change. If
you read back the value it will say thats its not checked but the controls is still checked and you can edit the values.
I can't even see a patern to when it decides to do it. Does anyone have an explanaition for this and hopefully a work around? Thanks for any help.

Nov 20 '05 #3

P: n/a
I tried that and it didn't work for me. I did figure out what the problem
is tough.

Aparently if you try to set a value to the control while the checkmark is
off it will turn it on and enter the value. It won't however turn it back
off after and more importantly it does not change the Checked property.

So I just reset the control to on at the start of every record that is being
read and if its null I turn it off AFTER its been updated. That solved my
problem. Thanks for the help anyways.
"solex" <so***@nowhere.com> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
Marco,

The datetime picker control does behave differently in one aspect from VB6, which I believe is bug. Assuming you set the value of the control on form
initialization, I have found that the first change event is not fired when
the user clicks the check box.

As a work around on form initialization I have found it necessary to
initialize the value and the checked status of the DTP control (in this
order) and then set the actual values, for instance:

Me.dtpStartDate.Value = Now()
Me.dtpStartDate.Checked = False

... set the appropriate values

You must understand that un-checking the control does NOT (a) disable the
control (b) set the value to null. Un-Checking the control only makes the
control appear to be disabled, further clicking or drop down of the picker
will automatically enable the control.

Regards,
Dan
"Marco Castro" <ma**************@benlan.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Is it just me or does the Checked property of the DateTimePickers not work properly?
I was trying to set it to off (which should disable the editing of the
control) to indicate that its a null value.
However sometimes when I do set it to off the control doesn't change. If you read back the value it will say thats its not checked but the

controls
is still checked and you can edit the values.
I can't even see a patern to when it decides to do it. Does anyone have

an
explanaition for this and hopefully a work around? Thanks for any help.


Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.