private void loadRegions() { //Load a list of region sslections try { LocationDS locationDS = new LocationDS(); LocationDS _ds = CustomerProxy.GetRegions(this.cboCompany.SelectedValue.ToString().PadLeft(6, '0').Substring(3, 3)); System.Collections.Hashtable table = new System.Collections.Hashtable(); for (int i = 0; i < _ds.LocationTable.Rows.Count; i++) { string region = _ds.LocationTable[i].Location.ToString().Trim(); if (region.Length == 0) { _ds.LocationTable[i].Delete(); } else { if (table.ContainsKey(region)) { _ds.LocationTable[i].Delete(); } else { table.Add(region, _ds.LocationTable[i].LocationName.ToString().Trim()); _ds.LocationTable[i].Location = region; _ds.LocationTable[i].LocationName = _ds.LocationTable[i].LocationName.ToString().Trim(); } } } locationDS.Merge(_ds, true); this.cboLocation.DisplayMember = "LocationTable.LocationName"; this.cboLocation.ValueMember = "LocationTable.Location"; this.cboLocation.DataSource = locationDS; } catch (Exception ex) { throw new ControlException("Unexpected error while loading company regions.", ex); } }