这个程序错哪里,为什么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;
}
}
}
}