private void listBoxCities_SelectedIndexChanged(object sender, EventArgs e) { bool valid = false; string processedName = listBoxCities.SelectedItem.ToString().Split(' ')[1]; foreach (CityProfile city in CityProfile.cityProfiles) { if (city.name == processedName) { selectedCity = city; valid = true; } } if (valid) { refreshCity(); } }
public Form1() { InitializeComponent(); CityProfile.initalize(); }