private void Tx_Search_TextChanged(object sender, EventArgs e) { var cityCaller = new myAPIcaller(); if (tx_Search.Text == "" || tx_Search.Text == null) { var cityInfo = cityCaller.GetAllCity(); displayCity(cityInfo); } else { try { var cityInfo = cityCaller.GetCity(Int32.Parse(tx_Search.Text)); displayCity(cityInfo); } catch { MessageBox.Show("Id does not exist!"); } } }