Hi,
I try to load a combobox with an ArrayList of object CultureInfo. For some reason I cannot map them although the ArrayList looks well populated in debugmode.
Any idea or way to appreach it better/quicker? Important, I do need the Name AND NativeName attribute of CultureInfo in the combobox in order to save the Name (LanguageCode) back to the settings file.
Thanks heaps
String[] cultreCode = Properties.Settings.Default.CultureCodes;
//create array of CultreInfo
CultureInfo[] ci = new CultureInfo[cultreCode.Length];
ArrayList alCultreInfo = null;
for(int i=0; i<cultreCode.Length; i++){
try{ alCultreInfo.Add(new CultureInfo(cultreCode));
}
catch (Exception ex){
Console.Out.WriteLine("Exception: {0} ", ex);
//do not handle invalid locales. later: log, this error, report back to the system administration
}
}
comboBoxLanguage.DataSource = alCultreInfo;
comboBoxLanguage.DisplayMember = "NativeName";
comboBoxLanguage.ValueMember = "Name";
comboBoxLanguage.Update();
I try to load a combobox with an ArrayList of object CultureInfo. For some reason I cannot map them although the ArrayList looks well populated in debugmode.
Any idea or way to appreach it better/quicker? Important, I do need the Name AND NativeName attribute of CultureInfo in the combobox in order to save the Name (LanguageCode) back to the settings file.
Thanks heaps
String[] cultreCode = Properties.Settings.Default.CultureCodes;
//create array of CultreInfo
CultureInfo[] ci = new CultureInfo[cultreCode.Length];
ArrayList alCultreInfo = null;
for(int i=0; i<cultreCode.Length; i++){
try{ alCultreInfo.Add(new CultureInfo(cultreCode));
}
catch (Exception ex){
Console.Out.WriteLine("Exception: {0} ", ex);
//do not handle invalid locales. later: log, this error, report back to the system administration
}
}
comboBoxLanguage.DataSource = alCultreInfo;
comboBoxLanguage.DisplayMember = "NativeName";
comboBoxLanguage.ValueMember = "Name";
comboBoxLanguage.Update();