There is a check box in the datetimepicker control of winforms .net. But I could not find the event that is triggered when the check box is checked or unchecked . Is there a way out?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Run into the same issue. I needed a CheckedChangedEvent on a winforms DateTimePicker control. So with the inspiration of the answers before me I created an inherited User Control named DateTimePicker2, inheriting from DateTimePicker that implements this event. It looks like it works but no guarantees.
And off-course don't forget to subscribe to the DateTimePicker2_ValueChanged event from the designer.
The reason why I used both a new Checked property (to hide the base.Checked one) and a _checked field to keep truck of the old value, is because
Basically a combination of both approaches was needed.
I hope this helps.
I know this is super old but this could help someone.
You can capture
DataTimePicker.MouseUp
eventYou will need to do the same with
KeyUp
event in order to get the Space key press that could also activate the checkbox.You´ll have to store the old "checked" value in order to compare to the new one, so you´ll be able to determine if the "checked" state has changed:
It does however trigger the value changed event