HAJJAJ HAJJAJ - 2 months ago 24
Vb.net Question

How to populate a dropdownlist with all countries?


Possible Duplicate:

Where can I get a list of all countries/cities to populate a listbox?




I'm trying to fill my dropdownlist with all world countries from windows, is there any way to make my dropdownlist get all countries from windows?

Or do anybody have a XML with all the list so I can use it?

Answer

Update 8/9/2016:

List of Countries


Just did a quick search and found this site:

http://madskristensen.net.web7.reliabledomainspace.com/post/XML-country-list.aspx.

Here's the direct link to the file:

http://cid-247fb0008340dbcd.office.live.com/self.aspx/workstion/countries.xml

Update: Code to populate your drop down list with the list of countries:

Dim doc = XDocument.Load("path to url\file")

Dim countries = From c in doc.Descendants("country")
                Select c.Value

For Each country In countries
    DropDownList.Add(country)
Next

DropDownList.DataBind()
Comments