private void LoadDepartments() { RSLib.COListItem li; SqlDataReader dr; dr = CBDepartment.GetList(); clstDepartments.Items.Clear(); li = new RSLib.COListItem(); li.ID = 0; li.Description = "All"; clstDepartments.Items.Add(li); while (dr.Read()) { li = new RSLib.COListItem(); li.ID = Convert.ToInt32(dr["ID"]); li.Description = dr["Name"].ToString(); clstDepartments.Items.Add(li); } clstDepartments.SetItemChecked(0, true); dr.Close(); }
private void LoadItemList() { SqlDataReader dr; ListViewItem lvi; this.Cursor = Cursors.WaitCursor; dr = CBDepartment.GetList(); lvwItems.Items.Clear(); while (dr.Read()) { lvi = new ListViewItem(); lvi.Text = dr["ID"].ToString(); lvi.SubItems.Add(dr["Name"].ToString()); lvi.SubItems.Add(dr["Description"].ToString()); lvi.SubItems.Add(dr["AcctGroup"].ToString()); lvwItems.Items.Add(lvi); } //lvwItems.ColumnClick += new ColumnClickEventHandler(lvwItems_ColumnClick); lvwItems.ColumnClick += new ColumnClickEventHandler(lvwItems_ColumnClick); // this line was added toooooooooooooooooooooooooooooooooo dr.Close(); dr = null; sbPanStatus.Text = lvwItems.Items.Count.ToString() + " department(s)"; this.Cursor = Cursors.Default; }
private void LoadDepartmentBox() { SqlDataReader dr; RSLib.COListItem li; dr = CBDepartment.GetList(); lstDept.Items.Clear(); while (dr.Read()) { li = new RSLib.COListItem(); li.ID = Convert.ToInt32(dr["ID"]); li.Description = dr["Name"].ToString(); lstDept.Items.Add(li); } dr.Close(); }