Avoid pressing . (period) key to move to next field in DateTime picker control

六眼飞鱼酱① 提交于 2020-01-15 09:21:07

问题


In datetime picker control the user has to press .(period) to move to different fields (like day, month year)

I want to override this behaviour by allowing the user to enter date without entering .(period)

Is there any to achieve this programmatically in C# winforms?

Thanks in advance.


回答1:


Not very beautiful code but you could of course send the . automatically.
Just handle the ValueChanged event (which will only be called when the user has entered a "whole" value for date part he's currently editing) and in the event handler you add the code SendKeys.Send(".");.



来源:https://stackoverflow.com/questions/3191972/avoid-pressing-period-key-to-move-to-next-field-in-datetime-picker-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!