FIX: DateTimePicker.getValue Fails After setShowNone(true) And setValue(null)

ID: Q223359


The information in this article applies to:


SYMPTOMS

When initializing the value of a DateTimePicker control to null programmatically and the object has setShowNone(true), you will notice that the value is not set to null as the documentation mentions and instead shows the current time.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


MORE INFORMATION

When initialized with setShowNone(true), the DateTimePicker control displays a checkbox next to the current DateTime value. If this checkbox is physically cleared by the user, then DateTimePicker.getValue() will return a null Time object as it should. However, if the DateTimePicker's value is set to null programmatically as shown in the following code, the DateTimePicker getValue method returns the current time, not null.


dateTimePicker1.setShowNone(true);
dateTimePicker1.setValue(null);
Time t = dateTimePicker1.getValue();
//t should be equal to null at this point 


REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:

http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/

Additional query words:


Keywords          : kbservicepack kbCmnCtrls kbVJ600fix kbWFC kbGrpJava kbVS600sp2 kbVS600sp2fix kbVS600SP1 kbVS600sp3fix kbVS600SP1fix 
Version           : WINDOWS:6.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 19, 1999