473,804 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateTimePickers .Checked Problems

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
3 3115
* "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
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******** *******@tk2msft ngp13.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
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******** ******@TK2MSFTN GP10.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******** *******@tk2msft ngp13.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3967
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
26
2920
by: OvErboRed | last post by:
I just read a whole bunch of threads on microsoft.public.dotnet.* regarding checked exceptions (the longest-running of which seems to be <cJQQ9.4419 $j94.834878@news02.tsnz.net>. My personal belief is that checked exceptions should be required in .NET. I find that many others share the same views as I do. It is extremely frustrating to have to work around this with hacks like Abstract ADO.NET and CLRxLint (which still don't solve the...
50
6196
by: jacob navia | last post by:
As everybody knows, the C language lacks a way of specifying bounds checked arrays. This situation is intolerable for people that know that errors are easy to do, and putting today's powerful microprocessor to do a few instructions more at each array access will not make any difference what speed is concerned. Not all C applications are real-time apps.
1
1509
by: Isra | last post by:
Hi I'm using dateTimePickers in C# app. there are 2 fixed and 1 optional pickers. Can I use null value for this optional dateTimePicker? i.e. dtP.value = null; ???????
6
1281
by: Peter Strøiman | last post by:
Hi. I have a situation where I have a web project and a class library in the same solution. The web project uses the class library. Therefore, I created a "project reference" in the web project to the call library. This creates a subfolder for my web application called "bin" where the output of my class library is placed. The problem is that this bin directory is placed in source safe when I check in the project to source control. And...
26
2826
by: Simon Jefferies | last post by:
Hello, I am trying to add an item to a checked list box, like: clbList.Items.add("Hello",true) I get an error back: Run-time exception thrown: System.ArgumentOutOfRangeException - Specified argument was out of the range of valid values. Parameter name: '-1' is not a
1
4116
by: Kevin R | last post by:
This is one of the weirdest problems I have ever run into. I have had to trim down a bunch of code to give a sample that is more easily readable by those who will view this. Here is the problem: I dynamically add an htmlcheckbox to a webform in the pages render and set the checked value to true. When the page loads, if I remove the check from the checkbox and then submit it, in the submit event the checkbox' checked value is still...
0
4105
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
1
4328
by: borla123 | last post by:
Hi- I'm trying to make an application that computes the fee for parking a car in a parking garage. The user should provide the Time In: and Time Out: values by using DateTimePickers. The application should calculate the cost of parking in the garage for the specified amount of time. Parking costs three dollars an hour. When calculating the total time spent in the garage, I will ignore the seconds value but the minutes value is treated as a...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.