WinForm中让ComboBox Add 键值对

            ArrayList mylist = new ArrayList();
            mylist.Add(new DictionaryEntry("0", "点图层"));
            mylist.Add(new DictionaryEntry("1", "线图层"));
            mylist.Add(new DictionaryEntry("2", "面图层"));
            SHPType.DataSource = mylist;
            SHPType.DisplayMember = "Value";
            SHPType.ValueMember = "Key"; 


        

         DictionaryEntry Item = (DictionaryEntry)SHPType.SelectedItem;  
          string selecteValue =  Item.Key.ToString();

你可能感兴趣的:(combobox)