Microsoft KB Archive/223359

From BetaArchive Wiki
Knowledge Base


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

Article ID: 223359

Article Last Modified on 6/14/2006



APPLIES TO

  • Microsoft Visual J++ 6.0 Standard Edition



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:

Keywords: kbbug kbcmnctrls kbfix kbvj600fix kbvs600sp1fix kbvs600sp2fix kbvs600sp3fix kbwfc KB223359