Windows Forms DatePicker not behaving in XP
This issue involves a Windows Forms VB.NET application. .NET version is 3.5
I have a datepicker control that is enabled/disabled by a checkbox. When the user checks the box, the datepicker is enabled and they select a date. However, for users running Windows XP, when they select a date the calendar reverts back to disabled and showing the current date (the unchecked state).
For Windows 7 users, the date is preserved and the datepicker remains in the enabled state. I am at a loss to find a workaround for this.
Short of migrating the users to Windows 7, is there anything I can do in my code?
Here is the code for the checkbox:
Sub CheckboxDates() Handles ckbPaid.CheckedChanged
If ckbPaid.Checked = True Then
dtPaidDate.Enab开发者_运维百科led = True
Else
dtPaidDate.Enabled = False
End If
End Sub
From what you describe, it sounds like you're getting click-through from the DatePicker causing it to uncheck the CheckBox.
Have you tried repositioning the CheckBox so that it's not under the calendar when it's displayed? Does that make a difference?
If it is click-through, you could try relocating the CheckBox or disabling it while the DatePicker is being used (using the DropDown and CloseUp events.)
精彩评论