如何在Windows应用程序中使用csharp禁用日历中的所有星期日 [英] how to disable all sundays in calendar using csharp in windows application
本文介绍了如何在Windows应用程序中使用csharp禁用日历中的所有星期日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个日历,在这个日历中我必须禁用所有星期日日期。
我怎么能用csharp。
注意这是Windows应用程序。
在运行模式下我已禁用所有星期日日期。
请帮帮我。
问候和谢谢,
Narasiman P.
i have one calendar,in this calendar i have to disable all sunday date.
for that how can i do using csharp.
Note It is windows application.
in the run mode i have disable all sunday date.
please help me.
Regards & Thanks,
Narasiman P.
推荐答案
hii
i认为它肯定会帮助你...只需转到此链接
制作你的自定义DateTimePicker控件。
http://forums.codeguru.com/showthread.php?289142-Disable-dates-on-date-timepicker-control [ ^ ]
乐于助人。
hii
i think it will definitely helps you...just go to this link
make your custom DateTimePicker Control.
http://forums.codeguru.com/showthread.php?289142-Disable-dates-on-date-timepicker-control[^]
Happy to Help.
很难禁用星期日,而不是我们可以限制用户不要选择星期日。
Hi,
It is difficult to disable the sunday, instead of we can restrict the user not to select the sunday.
DateTime lastDate;
System.Text.RegularExpressions.Regex rg;
bool valueChangingProgramatically = false;
public Form1()
{
InitializeComponent();
lastDate = dateTimePicker1.Value;
rg = new System.Text.RegularExpressions.Regex("Sunday");
if (lastDate < dateTimePicker1.Value)
dateTimePicker1.Value = dateTimePicker1.Value.AddDays(1);
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
if (!valueChangingProgramatically)
{
if (rg.IsMatch(dateTimePicker1.Value.ToLongDateString()))
{
valueChangingProgramatically = true;
dateTimePicker1.Value = lastDate;
//here you can also show a messagebox if you want.
}
}
else
valueChangingProgramatically = false;
lastDate = dateTimePicker1.Value;
}
您还可以使用其他自定义控件,请参考以下链接
http ://www.devexpress.com/Support/Center/p/Q148134.aspx
最好的问候
Muthuraja
You can also use other custom control, please refer the below link
http://www.devexpress.com/Support/Center/p/Q148134.aspx
Best Regards
Muthuraja
这篇关于如何在Windows应用程序中使用csharp禁用日历中的所有星期日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文