private void loadLstUnits() { // Create an instance of a ListView column sorter and assign it // to the ListView control. lvwColumnSorter = new ListViewColumnSorter(); this.lstUnits.ListViewItemSorter = lvwColumnSorter; ArrayList arrNew = new ArrayList(); String[] tmpArray = InfoLoader.loadUnits(true).Split('\n'); //do not include "OTHER" selectedUnitID = ""; lstUnits.BeginUpdate(); lstUnits.Clear(); lstUnits.Columns.Add("Units", 75, HorizontalAlignment.Left); lstUnits.Columns.Add("_SortUnits", 0, HorizontalAlignment.Left); //Add "All Units" option ListViewItem listItem = new ListViewItem("ALL UNITS"); listItem.Name = ""; lstUnits.Items.Add(listItem); //Add results from Units query for (int i = 0; i < tmpArray.Length; i++) { if (tmpArray[i].Trim().Length > 0) { listItem = new ListViewItem(tmpArray[i]); listItem.Name = tmpArray[i]; lstUnits.Items.Add(listItem); } } lstUnits.EndUpdate(); }
//Load Unit listbox lstUnitID private void loadLstUnit() { ArrayList arrNew = new ArrayList(); String[] tmpArray = InfoLoader.loadUnits(true).Split('\n'); for (int i = 0; i < tmpArray.Length; i++) { if (tmpArray[i].ToString().Trim().Length > 0) { arrNew.Add(new ListValues(tmpArray[i], ListValues.FORWARD)); } } lstUnitID.DataSource = arrNew; lstUnitID.DisplayMember = "Desc"; lstUnitID.ValueMember = "ID"; lstUnitID.ClearSelected(); }