// //EVENT HANDLERS // private void format_control() { MyNetwork.requestDanhSachKhuSan((object data) => { this.Invoke(new Action(() => { var khuSan = new KhuSan(); khuSan = (KhuSan)data; v_list_khu_san = khuSan.Data; List<ComboboxKhuSan> list = new List<ComboboxKhuSan>(); foreach (Dictionary<string, object> item in v_list_khu_san) { var cbItem = new ComboboxKhuSan(); cbItem.ID =decimal.Parse(item["id"].ToString()); cbItem.TenKhuSan = item["ten_khu_san"].ToString(); list.Add(cbItem); } comboBox1.DataSource = list; comboBox1.DisplayMember = "TenKhuSan"; comboBox1.ValueMember = "ID"; })); }); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { var item = new ComboboxKhuSan(); item = (ComboboxKhuSan)comboBox1.SelectedItem; v_current_id_khu_San = item.ID; //v_current_id_khu_San = decimal.Parse(dic["id"].ToString()); update_member(); }