Get the Nation of the User

This function gives the programmer the ability to determine the nation of the user. This could be useful for advertising purposes, or regional specific content. As far as I know, there is no function in the .NET framework that gives the programmer the ability to get the user's country, so I chose to use the registry.

VB.NET

''' <summary>
''' Get the Nation of the User.
''' </summary>
''' <returns>A String representation of the user's nation.</returns>
''' <remarks></remarks>

Public Function getNation() As String()
    Return My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Control Panel\International", "sCountry", Nothing)
End Function

' Example Usage
MessageBox.Show(getNation())

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License