Results 1 to 9 of 9

Thread: [RESOLVED] detect user country from regional settings

Threaded View

  1. #1

    Thread Starter
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Resolved [RESOLVED] detect user country from regional settings

    Hello there -
    I've searched around but can't find a clear answer for this. From my winforms VB2010 app, I'd like to be able to detect the country of the user's PC at runtime. Specifically, all I really need to detect is whether the user is in Australia or Canada.

    Most things I've seen will say "have a look at System.Globalization.CultureInfo", but with no clear example. I also know that the old-school "GetLocaleInfo" API can be used for this as well. I do have some code using the latter, which detects Australia when LOCALE_ICOUNTRY returns a value of 61. However, that won't work for Canada, as it returns 1, which is the same as USA (I know that these are based on telephone country codes).

    Anyway, ideally, I'd like to be able to use the .NET Globalization class to detect both - but if I have to use the GetLocaleInfo API that's fine - I'll take what I can get - at the very least, I'd like an example of how I can detect Canada.

    Any help on this is greatly appreciated ...
    Last edited by BruceG; Jul 25th, 2011 at 07:18 AM. Reason: resolved
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width