private void frmReleationRooms_Load(object sender, EventArgs e) { try { DataTable dtRooms = _qm.GetDeptRooms(_queueData.科室ID); checkedListBox1.DisplayMember = "Name"; checkedListBox1.ValueMember = "Value"; foreach (DataRow dr in dtRooms.Rows) { ItemBind ib = new ItemBind(); ib.Name = dr["房间名称"].ToString(); ib.Value = dr["房间ID"].ToString(); if (_queueData.包含房间.房间明细.FindIndex(T => T.房间ID == dr["房间ID"].ToString()) >= 0) { checkedListBox1.Items.Add(ib, true); } else { checkedListBox1.Items.Add(ib); } } } catch (Exception ex) { MsgBox.ShowException(ex, this); } }