Hello,
When the Culture is set to "ar-SA" the calendar controls throw this error: "Week #N does not exist in year XXXX based on the current week rule ..."
http://i62.tinypic.com/11v1ukm.jpg
Is there any way to force the use of a Gregorian calendar (in “ar-SA” culture)?
I'm trying but is not working. There are Optional calendars in the culture, but it always uses the main calendar.
The only work-around I'm having success is change culture to one that uses a Gregorian calendar.
If (System.Threading.Thread.CurrentThread.CurrentCulture.Calendar.GetType() <> GetType(System.Globalization.GregorianCalendar)) Then 'Dim ci As New Globalization.CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.LCID) ''ci.DateTimeFormat.Calendar = New System.Globalization.GregorianCalendar() 'ci.DateTimeFormat.Calendar = System.Threading.Thread.CurrentThread.CurrentCulture.OptionalCalendars(2) 'System.Threading.Thread.CurrentThread.CurrentCulture = ci ''System.Threading.Thread.CurrentThread.CurrentUICulture = ci
System.Threading.Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo("en-US") End If
Hello Jorge,
Thank you for contacting Infragistics Support.
By setting the culture of your application to “ar-SA” you are switching from Gregorian calendars to UmAlQuraCalendar. This calendar is not fully supported by .NET framework. You may try to run the following snippet:
CultureInfo culture = new CultureInfo("ar-SA");
Thread.CurrentThread.CurrentCulture = culture;
try
{
int months = culture.Calendar.GetMonthsInYear(DateTime.Today.Year);
}
catch(Exception ex)
MessageBox.Show(ex.Message);
If you run that you’ll see that an exception is thrown. Please note that Infragistics controls support only Gregorian calendars.
Please let me know if you need any further assistance.