private void _btnDetectLanguages_Click(object sender, EventArgs e) { _lbPageLanguages.Items.Clear(); string[] suggestedLanguages = new string[_lbSuggestedLanguages.SelectedItems.Count]; int index = 0; foreach (MyLanguage language in _lbSuggestedLanguages.SelectedItems) { suggestedLanguages[index] = language.Language; index++; } string[] pageLanguages = _ocrPage.DetectLanguages(suggestedLanguages); if (pageLanguages != null && pageLanguages.Length > 0) { foreach (string lang in pageLanguages) { string friendlyName = MyLanguage.GetLanguageFriendlyName(lang); _lbPageLanguages.Items.Add(friendlyName); } } }