最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#中comboBox實(shí)現(xiàn)三級(jí)聯(lián)動(dòng)

 更新時(shí)間:2018年03月27日 15:17:07   作者:彬菌  
給大家分享了C#中comboBox實(shí)現(xiàn)三級(jí)聯(lián)動(dòng)的全部代碼,代碼經(jīng)過(guò)測(cè)試,有興趣的朋友跟著做一下。

實(shí)現(xiàn)效果:

Form1.cs代碼

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;

namespace Select
{
 public partial class Form1 : Form
 {
 public Form1()
 {
  InitializeComponent();
 }
 Hashtable province = new Hashtable();
 Hashtable city = new Hashtable();
 private void Province()
 {
  province.Add("云南省",new string[] {"昆明市","玉溪市" });
  province.Add("四川省", new string[] { "成都市", "綿陽(yáng)市" });
  city.Add("昆明市",new string[] {"盤龍區(qū)","五華區(qū)" });
  city.Add("玉溪市",new string[] {"紅塔區(qū)","。。。區(qū)" });
  city.Add("成都市", new string[] { "。。。區(qū)", "。。。區(qū)" });
  city.Add("綿陽(yáng)市", new string[] { "...區(qū)", "...區(qū)" });
 }

 private void Form1_Load(object sender, EventArgs e)
 {
  Province();
  foreach (string str in province.Keys)
  {
  comboBox1.Items.Add(str);
  }
  foreach (string str in city.Keys)
  {
  comboBox2.Items.Add(str);
  }
  comboBox1.SelectedIndex=0;
 }

 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
  string[] citys = province[comboBox1.Text] as string[];
  comboBox2.Items.Clear();
  foreach (string s in citys)
  {
  comboBox2.Items.Add(s);
  } 
  comboBox2.SelectedIndex = 0;
 }
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
  string[] citys = city[comboBox2.Text] as string[];
  comboBox3.Items.Clear();
  foreach (string str in citys)
  {
  comboBox3.Items.Add(str);
  }
  comboBox3.SelectedIndex = 0;
 }

 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {

 }
 }
}

更多相關(guān)的實(shí)現(xiàn)方法大家可以閱讀下面的相關(guān)內(nèi)容,感謝大家對(duì)腳本之家的支持。

本文轉(zhuǎn)載于:https://www.idaobin.com/archives/970.html

相關(guān)文章

最新評(píng)論

麻城市| 蓬莱市| 固阳县| 黎平县| 忻州市| 建德市| 鄂州市| 洪雅县| 聂拉木县| 鸡泽县| 图片| 沐川县| 莫力| 房产| 临澧县| 海伦市| 江孜县| 隆德县| 建瓯市| 来安县| 榆中县| 个旧市| 南安市| 吴旗县| 宁陵县| 腾冲县| 保山市| 丰原市| 肥东县| 和顺县| 灵石县| 文昌市| 鄂州市| 太湖县| 河北省| 开阳县| 嘉鱼县| 临猗县| 鹤岗市| 高邮市| 洪雅县|