protected void Button1_Click(object sender, EventArgs e)
{
int current_day = Calendar1.VisibleDate.Day;
int current_month = Calendar1.VisibleDate.Month;
int current_year = Calendar1.VisibleDate.Year;
Calendar1.SelectedDates.Clear();
// Loop through current month and add all Wednesdays to the collection.
for (int i = 1; i <= System.DateTime.DaysInMonth(current_year,
current_month); i++)
{
DateTime targetDate = new DateTime(current_year, current_month, i);
if (targetDate.DayOfWeek == DayOfWeek.Wednesday)
Calendar1.SelectedDates.Add(targetDate);
}
Text1.Text = "Selection Count =" + Calendar1.SelectedDates.Count;
}
{
int current_day = Calendar1.VisibleDate.Day;
int current_month = Calendar1.VisibleDate.Month;
int current_year = Calendar1.VisibleDate.Year;
Calendar1.SelectedDates.Clear();
// Loop through current month and add all Wednesdays to the collection.
for (int i = 1; i <= System.DateTime.DaysInMonth(current_year,
current_month); i++)
{
DateTime targetDate = new DateTime(current_year, current_month, i);
if (targetDate.DayOfWeek == DayOfWeek.Wednesday)
Calendar1.SelectedDates.Add(targetDate);
}
Text1.Text = "Selection Count =" + Calendar1.SelectedDates.Count;
}
解决方案 »
- 有谁做过在wpf 界面中打开word,office,和powerpoint文件
- 微软做的馒头太硬了,好难啃啊!
- 关于用C#动态调用webservice
- 在C#.Net中如可判断文本框输入的不是汉字和符号(含空格)
- c#实现导出的excel文本转数值的方法!
- 长名称转短名称API GetShortPathName 多次长名称时出现的问题
- 报错啦!报错啦!又报错啦!
- word文件 表格写入问题
- C# C/S应用程序 反序列化时出错 错误源是mscorlib
- 有没有人用过mysqldrivercs 我怎么不能用?
- 注册表关联协议,是如何发送消息的,程序又是如何接受消息的?
- 问个RightToLeft的问题
还是点击文本框出现Calendar1?
private void textBox1_Enter(object sender, EventArgs e)
{
monthCalendar1.Visible = true;;
}
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
textBox1.Text = monthCalendar1.SelectionStart.ToString("yyyy-MM-dd");
monthCalendar1.Visible = false;
}