Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Globalization and ComboBox of Countries

System.Globalization and ComboBox of Countries

Scheduled Pinned Locked Moved C#
tutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ryan Minor
    wrote on last edited by
    #1

    Hi there I understand I can create a list of countries in a combobox using System.Globalization. I haven't been able to figure out how to do it. Anybody know how?

    OriginalGriffO 1 Reply Last reply
    0
    • R Ryan Minor

      Hi there I understand I can create a list of countries in a combobox using System.Globalization. I haven't been able to figure out how to do it. Anybody know how?

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      public static List<string> GetCountryList()
      {
      List<string> cultureList = new List<string>();
      CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
      foreach (CultureInfo culture in cultures)
      {
      RegionInfo region = new RegionInfo(culture.LCID);
      if (!(cultureList.Contains(region.EnglishName)))
      cultureList.Add(region.EnglishName);
      }
      return cultureList;
      }

      Then just add the list to the combobox

      I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      L 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        public static List<string> GetCountryList()
        {
        List<string> cultureList = new List<string>();
        CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
        foreach (CultureInfo culture in cultures)
        {
        RegionInfo region = new RegionInfo(culture.LCID);
        if (!(cultureList.Contains(region.EnglishName)))
        cultureList.Add(region.EnglishName);
        }
        return cultureList;
        }

        Then just add the list to the combobox

        I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Wow. I had no idea .NET held a list of countries like that. And grrrr, they had to use the French "NativeName" for Belgium. So why don't they show the US in Spanish? In fact they do, if we look at all the cultures, including EnglishName duplicates. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read formatted code with indentation, so please use PRE tags for code snippets.


        I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


        modified on Sunday, May 16, 2010 2:59 PM

        OriginalGriffO 1 Reply Last reply
        0
        • L Luc Pattyn

          Wow. I had no idea .NET held a list of countries like that. And grrrr, they had to use the French "NativeName" for Belgium. So why don't they show the US in Spanish? In fact they do, if we look at all the cultures, including EnglishName duplicates. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read formatted code with indentation, so please use PRE tags for code snippets.


          I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


          modified on Sunday, May 16, 2010 2:59 PM

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          It's nice to know it's not just me who keeps on finding new things in .NET! :laugh:

          I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups