Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleFill a ComboBox with a list of countries
Keywordscountry, countries
CategoriesMiscellany, Software Engineering
 
Thanks to Dinesh Asanka.

Enumerate the keys inside the Registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
    CurrentVersion\Telephony\Country List\

Those keys' Name values give the country names.

 
Const ValueName As String = "Name"
Const MasterKey As String = _
    "SOFTWARE\Microsoft\Windows\CurrentVersion\Telephony\Country " & _
    "List\"

Private Sub Form_Load()
    Dim KeyCol As Collection
    Dim strCountry As String
    If CheckRegistryKey(HKEY_LOCAL_MACHINE, MasterKey) Then
        
        Set KeyCol = EnumRegistryKeys(HKEY_LOCAL_MACHINE, _
            MasterKey)
        Dim TheKey As Variant
        Set CountryCol = New Collection
        
        For Each TheKey In KeyCol
             If TheKey <> "800" And _
                 GetRegistryValue(HKEY_LOCAL_MACHINE, _
                 MasterKey & TheKey, "InternationalRule", _
                 "") <> "00EFG#" Then
                CboCountry.AddItem _
                    GetRegistryValue(HKEY_LOCAL_MACHINE, _
                    MasterKey & TheKey, ValueName, "")
             End If
        Next
    End If
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated