c#输入日期如改变datetimepicker的值 本帖最后由 bdmh 于 2014-01-13 11:12:16 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DateTime sj = DateTime.Now.AddMonths(-6); 月份减还有天书年什么的 改成+就好了 定好初始时间然后 private void textBox2_TextChanged(object sender, EventArgs e) { this.dateTimePicker1.Format = DateTimePickerFormat.Custom; this.dateTimePicker1.ShowUpDown = true; this.dateTimePicker1.CustomFormat = "yyyy年MM月dd日"; dateTimePicker1.Text = ""; switch (comboBox2.Text) { case "月": dateTimePicker1.Text = this.dateTimePicker1.Value.AddMonths(int.Parse(textBox2.Text)).ToString(); break; case "周": //这里不对。你自己在处理下周的 break; case "天": dateTimePicker1.Text = this.dateTimePicker1.Value.AddDays(int.Parse(textBox2.Text)).ToString(); break; default: break; } }已测试、 图像处理的基线校正问题 高手请进 C# 里恢复数据库问题 如何检测图片的文字环绕方式? 为什么richtextbox里面的字体会一个一个改变 .net项目封装后怎么解开封装??急急急急急急急急急急急急 释放资源后为什么还能.ToArray() 请问C#怎样用钩子? 为什么vs2005中看不到microsoft.windowsmobile.pocketoutlook 【linq】如何在Select的同时过滤 做一个任务算法 用C#语言完成的控制台窗口 请问使用WeifenLuo.WinFormsUI.Docking布局控件的问题
还有天书年什么的 改成+就好了 定好初始时间然后
{
this.dateTimePicker1.Format = DateTimePickerFormat.Custom;
this.dateTimePicker1.ShowUpDown = true;
this.dateTimePicker1.CustomFormat = "yyyy年MM月dd日";
dateTimePicker1.Text = "";
switch (comboBox2.Text)
{
case "月":
dateTimePicker1.Text = this.dateTimePicker1.Value.AddMonths(int.Parse(textBox2.Text)).ToString();
break;
case "周":
//这里不对。你自己在处理下周的
break;
case "天":
dateTimePicker1.Text = this.dateTimePicker1.Value.AddDays(int.Parse(textBox2.Text)).ToString();
break;
default: break;
}
}
已测试、