private void FillStation() { const string METHOD_NAME = "FillStation"; try { ArrayList listIDs = new System.Collections.ArrayList(_stationList.Split(new char[] { ',' })); ListBox lst = lstFaStation; lst.Items.Clear(); List<ListBeetStationIDItem> stateList = WSCReportsExec.StationListGetByFactory(_factoryList); System.Text.StringBuilder sbList = new System.Text.StringBuilder(""); foreach (ListBeetStationIDItem state in stateList) { ListItem item = new ListItem(state.StationNumberName, state.StationID); lst.Items.Add(item); if (listIDs.Contains(item.Value)) { lst.Items[lst.Items.Count - 1].Selected = true; // Rebuild stationList because the listIDs is now qualified against // stations assigned to the valid factory list. sbList.Append(item.Value + ","); } } if (sbList.Length > 0) { sbList.Length = sbList.Length - 1; } _stationList = sbList.ToString(); } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }