I have made a custom class by inheriting a DateTimePicker and made some methods that allow it to be blank/null.
If the control is blank and a user clicks on it, it populates with the current date. It also raises the ValueChanged
event.
If the control is populated and a user presses delete, it clears and sets its value to null, but the ValueChanged
event doesn't trigger.
In the control's OnKeyDown
method, I would like to include some code that raises the ValueChanged
event, but there doesn't seem to be a way to do that.
Do I need to override the base class event? Is there an applicable example?
DateTimePicker.OnValueChanged将引发ValueChanged事件。
You have to call/override DateTimePicker.OnValueChanged()
. This method calls the event, so you can implement your code through this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.