点击按钮 月份增减 上一个按钮 1月 2月 3月 4月 5月 下一个按钮点击右边的按钮 则变成2月 3月 4月 5月 6月 下一个按钮 再次点击变成 3月 4月 5月 6月 7月 依次类推,还要跨年 该怎么做呢?能否给出完整的代码,非常感谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public partial class Form1 : Form { public Form1() { InitializeComponent(); textBox1.Text = string.Format("{0}月 {1}月 {2}月 {3}月 {4}月",a,b,c,d,h); } private int a=1; private int b=2; private int c=3; private int d=4; private int h=5; private void button1_Click(object sender, EventArgs e) { if (a > 1)//保证最小月份不小于1; { a--; b--; c--; d--; h--; textBox2.Text = string.Format("{0}月 {1}月 {2}月 {3}月 {4}月", a, b, c, d, h); } else textBox1.Text = "日子可不能往回过哦!"; } private void button2_Click(object sender, EventArgs e) { if (h < 12)//保证最大月份不超过12 {a++; b++; c++; d++; h++; textBox2.Text = string.Format("{0}月 {1}月 {2}月 {3}月 {4}月", a, b, c, d, h); } else textBox1.Text = "又是一年开始喽!!!"; } } 这个帖子你发了两遍了,另外一个帮你答复了: //下一个月 private void button2_Click(object sender, EventArgs e) { DateTime preMonth = DateTime.Now.AddMonths(1); this.label1.Text = preMonth.Month.ToString(); } //上一个月 private void button3_Click(object sender, EventArgs e) { DateTime preMonth = DateTime.Now.AddMonths(-1); this.label1.Text = preMonth.Month.ToString(); } 我发了好3次,前两次描述都不是很全面, private void button2_Click(object sender, EventArgs e) { DateTime preMonth = DateTime.Now.AddMonths(1); this.label1.Text = preMonth.Month.ToString(); } //上一个月 private void button3_Click(object sender, EventArgs e) { DateTime preMonth = DateTime.Now.AddMonths(-1); this.label1.Text = preMonth.Month.ToString(); }按着这个方法做,从5月到6月就再也不动了,我需要每点一次就加一个月,还要判断是今年还是明年或是前年,这样好像实现不了,请各位高手再帮帮忙 如何保存propertyGrid的值 两张JPG图片,拼成一张! 谁有兴趣看看这个DataGridView合并单元格的问题 Winform程序怎么发布? 类的继承问题????? c# ECB模式与PKCS#5填充方式加密方法92456 使用clickonce发布后,客户端安装完毕系统提示:验证没有通过,无法启用之类的信息。请问如何解决 这个问题好像有点麻烦~```~~麻烦兄弟们来看看!~` 汇编学的好的兄弟帮偶看道简单的题目 紧急求助关于LISTVIEW Math.Round 急!急!!急!!!。。。请大家来帮帮忙,找找资料,关于C#更新包的问题
{
public Form1()
{
InitializeComponent();
textBox1.Text = string.Format("{0}月 {1}月 {2}月 {3}月 {4}月",a,b,c,d,h);
} private int a=1;
private int b=2;
private int c=3;
private int d=4;
private int h=5;
private void button1_Click(object sender, EventArgs e)
{
if (a > 1)//保证最小月份不小于1;
{
a--; b--; c--; d--; h--; textBox2.Text = string.Format("{0}月 {1}月 {2}月 {3}月 {4}月", a, b, c, d, h);
} else
textBox1.Text = "日子可不能往回过哦!";
}
private void button2_Click(object sender, EventArgs e)
{ if (h < 12)//保证最大月份不超过12
{a++; b++; c++; d++; h++;
textBox2.Text = string.Format("{0}月 {1}月 {2}月 {3}月 {4}月", a, b, c, d, h);
} else
textBox1.Text = "又是一年开始喽!!!";
}
}
private void button2_Click(object sender, EventArgs e)
{
DateTime preMonth = DateTime.Now.AddMonths(1);
this.label1.Text = preMonth.Month.ToString();
} //上一个月
private void button3_Click(object sender, EventArgs e)
{
DateTime preMonth = DateTime.Now.AddMonths(-1);
this.label1.Text = preMonth.Month.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
DateTime preMonth = DateTime.Now.AddMonths(1);
this.label1.Text = preMonth.Month.ToString();
} //上一个月
private void button3_Click(object sender, EventArgs e)
{
DateTime preMonth = DateTime.Now.AddMonths(-1);
this.label1.Text = preMonth.Month.ToString();
}
按着这个方法做,从5月到6月就再也不动了,我需要每点一次就加一个月,还要判断是今年还是明年或是前年,这样好像实现不了,请各位高手再帮帮忙