I want to set a culture for entire winform application.
How can i do that?
I changed my Program.cs
file like this :
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Divar
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
var culture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new RadForm1());
}
}
}
Did i do it right?
Also there is another link about that :(Please take a look)
https://www.c-sharpcorner.com/forums/set-cultureinfo-for-winform-application
This has limited success, so at the top of "Form1" before the InitializeComponent() I placed:
System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("en-GB");
Application.CurrentCulture = cultureInfo;
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-GB");
Is it necessary to add those three lines before the InitializeComponent() in every form?