private void chcmbPhong_Click(object sender, EventArgs e) { if (dtpNgayNhan.Value == DateTime.Now) { MessageBox.Show("Ngày nhận phải lớn hơn hoặc bằng ngày hiện tại"); return; } if (dtpNgayNhan.Value > dtpNgayTra.Value) { MessageBox.Show("Cần nhập ngày nhận nhỏ hơn ngày trả"); return; } frmPhong _frm = new frmPhong(dtpNgayNhan.Value, dtpNgayTra.Value); _frm.StartPosition = FormStartPosition.CenterScreen; _frm.ShowDialog(); for (int i = 0; i < ccbeMaPhong.Properties.GetItems().Count; i++) ccbeMaPhong.Properties.GetItems()[i].CheckState = CheckState.Unchecked; foreach (int _i in _frm.PhongChon) { foreach (DevExpress.XtraEditors.Controls.CheckedListBoxItem s in ccbeMaPhong.Properties.GetItems()) { if (s.ToString() == _i.ToString()) { s.CheckState = CheckState.Checked; break; } } } }
public frmDoiPhong(frmPhong phong) { Phong = phong; InitializeComponent(); }