Results 1 to 3 of 3

Thread: Get System Culture?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2015
    Posts
    68

    Get System Culture?

    Hi guys,

    I have to change the application's System culture to US English.
    However, when I try to retrieve the system's default numbers culture (which is German), it returns English with the CultureInfo.CurrentCulture and other calls.

    So, how do I get the real setting for the System and not the app/threads?

    Thanks
    Last edited by chrisf8657; Oct 15th, 2017 at 11:50 AM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: Get System Culture?

    Try this...

    Code:
    Imports System.Threading
    Imports System.Globalization
    
    Public Class Form1
    
        Dim systemCulture As CultureInfo
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            'store system culture
            'change app culture
            systemCulture = Thread.CurrentThread.CurrentCulture()
            Thread.CurrentThread.CurrentCulture() = New CultureInfo("fr-FR")
            MsgBox(Thread.CurrentThread.CurrentCulture().Name)
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            'restore app culture to system culture
            Thread.CurrentThread.CurrentCulture() = systemCulture
            MsgBox(Thread.CurrentThread.CurrentCulture().Name)
        End Sub
    
    End Class

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2015
    Posts
    68

    Re: Get System Culture?

    That's a start.
    Thanks!

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