本文介绍了如何在C#日期时间选择器中设置最大时间和最小时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在C#Windows Forms应用程序中使用日期时间选择器。
I am using a datetime picker in c# windows forms application.
如何设置最小时间和最大时间?我有一个字符串 07:52:22,我想将其设置为最大或最小时间。我该怎么做?
How to set the the min time and max time ? I have a string "07:52:22" and I want to set this as the max or min time. How can I do this ?
DatetimePicker.MinDate.TimeOfDay = "07:52:22";
这是错误的,但这就是我想要的。
This is wrong but this is what I want.
推荐答案
DateTimePicker datePicker = new DateTimePicker;
dateTimePicker.MinDate = DateTime.Parse("7:52:22");
这篇关于如何在C#日期时间选择器中设置最大时间和最小时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!