private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (CmbProvince.SelectedIndex == “辽宁”)
{
CmbCity.Items.Clear(); CmbCity.Items.Add(“沈阳”); CmbCity.Items.Add(“大连”); CmbCity.Items.Add(“葫芦岛”); CmbCity.Items.Add(“锦州”); } if(CmbProvince.SelectedIndex == “山西”)
{
CmbCity.Items.Clear(); CmbCity.Items.Add(“太原”); CmbCity.Items.Add(“大同”); CmbCity.Items.Add(“阳泉”); CmbCity.Items.Add(“晋城”);
}
if (CmbProvince.SelectedIndex == “浙江”)
{
CmbCity.Items.Clear(); CmbCity.Items.Add(“杭州”); CmbCity.Items.Add(“宁波”); CmbCity.Items.Add(“温州”); CmbCity.Items.Add(“嘉兴”);
}
}
private void button1_Click(object sender, EventArgs e)
{
label4.Text = “籍贯:” + CmbProvince.Text + “省”+ comboBox2.Text + “市”; MessageBox.Show(“查询成功”);
}
2020-11-29
![](https://img-home.csdnimg.cn/images/20240711042549.png)