| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5799 人关注过本帖
标题:这个程序错哪里,为什么comboBox1里只有29项
取消只看楼主 加入收藏
别忘了当初
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2019-7-24
结帖率:100%
收藏
 问题点数:0 回复次数:0 
这个程序错哪里,为什么comboBox1里只有29项
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 选择日期02275
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("今天是"+comboBox3.Text+"年"+comboBox2.Text+"月"+comboBox1.Text+"日");
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int i,a,b;

            for (i = 1000; i <= 2050; i++)
            {
                comboBox3.Items.Add(i);
            }
            for (a = 1; a <=12; a++)
            {
                comboBox2.Items.Add(a);
            }
            switch (a)
            {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    for (b = 0; b <= 31; b++)
                    {
                            comboBox1.Items.Add(b);
                    }
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                   for (b = 0; b <= 30; b++)
                   {
                        comboBox1.Items.Add(b);
                   }
                   break;
                default:
                case 2:
                    if (i % 4 == 0)
                    {
                        for (b = 0; b <= 28; b++)
                        {
                            comboBox1.Items.Add(b);
                        }
                    }
                    else
                    {
                        for (b = 0; b <= 29; b++)
                        {
                            comboBox1.Items.Add(b);
                        }
                    }

                    break;
            }
        }
    }
}
搜索更多相关主题的帖子: case Add using for System 
2019-09-04 12:03
快速回复:这个程序错哪里,为什么comboBox1里只有29项
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.308205 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved