上一个按钮  1月 2月 3月 4月 5月 下一个按钮点击右边的按钮 则变成2月 3月 4月 5月 6月 下一个按钮  再次点击变成 3月 4月 5月 6月 7月
 依次类推,还要跨年 该怎么做呢?
能否给出完整的代码,非常感谢

解决方案 »

  1.   

     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 = "又是一年开始喽!!!";
                
                
            }
        }
      

  2.   

    这个帖子你发了两遍了,另外一个帮你答复了:        //下一个月
            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.   

    我发了好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月就再也不动了,我需要每点一次就加一个月,还要判断是今年还是明年或是前年,这样好像实现不了,请各位高手再帮帮忙