Application hangs after changing language From “En-Us” to any global language in control panel
- by user1764824
I created a WinForms application using C#. When I try to change the culture info, my application gets hanged.
Microsoft.Win32.SystemEvents.UserPreferenceChanged += new
Microsoft.Win32.UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
void SystemEvents_UserPreferenceChanged(object sender, Microsoft.Win32.UserPreferenceChangedEventArgs e)
{
if (!PreviousInstance())
{
CultureInfo ObjCulture = new CultureInfo(CultureInfo.InvariantCulture.IetfLanguageTag, false);
Thread.CurrentThread.CurrentCulture = ObjCulture;
Application.CurrentCulture = ObjCulture;
}
}
public void INIT()
{
CultureInfo objCultureInfo = null;
try
{
objCultureInfo = new CultureInfo("en-US", false);
objCultureInfo.NumberFormat.NumberDecimalSeparator = ".";
objCultureInfo.NumberFormat.NegativeSign = "-";
objCultureInfo.NumberFormat.NumberNegativePattern = 1; //1 stands for -100.
Application.CurrentCulture = objCultureInfo;
}
}
After Changing Language ... My Application gets Hanged and i cant Debug anything When i Try to Evaluate things This Event Called only once.. But if try in a small application it comes every time when Language is changed... ... Nothing shown in Eventviewer either. How can I solve this problem? ..