其他分享
首页 > 其他分享> > 2020-11-29

2020-11-29

作者:互联网

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(“查询成功”); }

标签:11,Items,Clear,29,SelectedIndex,Add,2020,CmbProvince,CmbCity
来源: https://blog.csdn.net/weixin_48219113/article/details/110342352