You must Sign In to post a response.
  • Category: .NET

    Want to access control panel through code in c#


    I want to check what ever setting are there in region and language in control panel through code in C#
    . Kindly Reply
  • #764610
    using System.Globalization;
    using System.Threading;
    DateTime dt = DateTime.Now;
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");//Set CurrentCulture to english U.S
    Console.WriteLine(dt.ToString("d"));//Get date

    Or you can modify registry entries as follows:
    using Microsoft.Win32;
    RegistryKey objRegKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
    string[] szLang = { "en-ZA" };
    objRegKey.SetValue("PreferredUILanguagesPending", szLang, RegistryValueKind.MultiString);//REG_MULTI_SZ
    Please go through this article for more details:
    Hope it helps.
    Shashikant Gurav

  • #764618
    To get default regional and language setting, you need to hit to control panel, Just use System.globalization namespace, it will return the system settings.
    see below snippet
    using System;
    using System.Globalization;

    public class Example
    public static void Main()
    CultureInfo culture = CultureInfo.CurrentUICulture;
    Console.WriteLine("The current UI culture is {0} [{1}]",
    culture.NativeName, culture.Name);
    // The example displays output like the following:
    // The current UI culture is English (United States) [en-US]

    in above code you will all information about current CurrentCulture. you can set new culture using code also.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #764657

    You may use CultureInfo object to accomplish this task.

    Below is the sample code which may help you,

    Asheej T K

  • Sign In to post your comments