private void Btn_Update_Click(object sender, EventArgs e) { City c = new City(); c.Id = selectedId; c.Name = tx_CityName.Text; c.CountryCode = tx_CountryCode.Text; c.District = tx_District.Text; c.Population = tx_Population.Text; var caller = new myAPIcaller(); caller.UpdateCity(c); displayAllCaller(); foreach (Control tx in panel1.Controls) { if (tx is TextBox) { tx.Text = ""; } } }