Change dropdownlist to combobox for windows forms.

Posted on 2008-11-10
Last Modified: 2012-05-05
I need the function on this page

in C# code for windows forms.  any ideas?
Question by:casit
    LVL 7

    Accepted Solution

    For the most part - that is fine.

    I've created a form with nothing but a combobox.  See code below
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections.Generic;
    using System.ComponentModel;
    using Microsoft.Win32;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace Testing
        public partial class Form1 : Form
            public Form1()
            private List<string> GetCountries()
                List<string> returnValues = new List<string>();
                RegistryKey countries =
                  "Software\\Microsoft\\Windows\\CurrentVersion" +
                  "\\Telephony\\Country List");
                if (countries != null)
                    // Get the list of subkeys,
                    // which is actually the country code
                    string[] subkeys = countries.GetSubKeyNames();
                    foreach (string ccode in subkeys)
                        // Open the subkey, to get the country name
                        RegistryKey country = countries.OpenSubKey(ccode);
                        // ..get the country name from country key
                        // We're done using the key, we should close it
                    // It's now safe to close the country list key
                return returnValues;
            private void Form1_Load(object sender, EventArgs e)
                List<string> countries = GetCountries();
                foreach (string country in countries)

    Open in new window


    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    This video discusses moving either the default database or any database to a new volume.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now