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


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.


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


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


For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

ID članka: 223359 - posljednja izmjena: 14. velj 2017. - verzija: 1

Microsoft Visual J++ 6.0 Standard Edition

Povratne informacije