public void HienThi(ListView list, ComboBox day, ComboBox trangthai) { PhongData phong = new PhongData(); list.Items.Clear(); DataTable table = phong.LayDSPhong(); foreach (DataRow row in table.Rows) { PhongInfo info = RowToInfo(row); ListViewItem item = new ListViewItem(); item.Text = info.MaPhong; item.SubItems.Add(info.TenPhong); item.SubItems.Add(info.Day.TenDay); item.SubItems.Add(info.SoLuongToiDa.ToString()); item.SubItems.Add(info.TrangThai.TenTrangThai); item.SubItems.Add((info.PhongNam == true?"Nam":"Nữ")); item.Tag = info; list.Items.Add(item); } //---------------- DayCtrl dayctrl = new DayCtrl(); dayctrl.LayDuLieuLenComboBox(day); TrangThaiPhongCtrl dayctrl1 = new TrangThaiPhongCtrl(); dayctrl1.LayDuLieuLenComboBox(trangthai); }
public void LayDuLieuLenComboBox(ComboBoxEx cmb) { PhongData hd = new PhongData(); DataTable table = hd.LayDSPhong(); cmb.DataSource = table; cmb.DisplayMember = "TENPHG"; cmb.ValueMember = "MAPHG"; }
public void LayDuLieuLenComboBoxItem(ComboBoxItem cmb) { PhongData hd = new PhongData(); DataTable table = hd.LayDSPhong(); foreach (DataRow row in table.Rows) { cmb.Items.Add(row["TenPHG"]); } //cmb.DisplayMember = "TENPHG"; //cmb.ValueMember = "MAPHG"; }