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



The information in this article applies to:

  • Microsoft Visual J++ 6.0

This article was previously published under Q223359

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 that this is a bug in the Microsoft products that are 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:

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

194295 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 support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbbug kbCmnCtrls kbfix kbVJ600fix kbVS600SP1fix kbVS600sp2fix kbVS600sp3fix kbWFC KB223359