private void cmbCountry_SelectedIndexChanged(object sender, EventArgs e) { try { ListRadio objListRadio = new ListRadio(cmbCountry.SelectedValue.ToString()); List <RadioChannel> lst = objListRadio.GetCountryWiseRadio(); lst.Insert(0, new RadioChannel { Country = "Select...", Name = "Select...", Url = "" }); cmbChannel.DataSource = lst; cmbChannel.DisplayMember = "Name"; cmbChannel.ValueMember = "Url"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public MainForm() { try { InitializeComponent(); ListRadio objListRadio = new ListRadio(); List <RadioChannel> lst = objListRadio.GetAllCountry(); lst.Insert(0, new RadioChannel { Country = "Select...", Name = "Select...", Url = "" }); cmbCountry.DataSource = lst; cmbCountry.DisplayMember = "Country"; cmbCountry.ValueMember = "Country"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }