private void PopulateCombos() { try { DataTable dt = new DataTable(); DAL.Towns obj = new DAL.Towns(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(string.Empty); CmbTown.ValueMember = "TownID"; CmbTown.DisplayMember = "TownName"; CmbTown.DataSource = dt; DAL.Towns objF = new DAL.Towns(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(string.Empty); CmbFilter.ValueMember = "TownID"; CmbFilter.DisplayMember = "TownName"; CmbFilter.DataSource = dt; } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void PopulateCombos() { try { DataTable dt = new DataTable(); DAL.Offices obj = new DAL.Offices(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(string.Empty); CmbOffice.DataSource = dt; CmbOffice.ValueMember = "OfficeID"; CmbOffice.DisplayMember = "Description"; DAL.Towns objT = new DAL.Towns(); objT.connectionstring = objDAL.connectionstring; dt = objT.getRecord(string.Empty); CmbTown.ValueMember = "TownID"; CmbTown.DisplayMember = "TownName"; CmbTown.DataSource = dt; DAL.PartyGroups objG = new DAL.PartyGroups(); objG.connectionstring = objDAL.connectionstring; dt = objG.getRecord(string.Empty); CmbGroups.DataSource = dt; CmbGroups.ValueMember = "GroupID"; CmbGroups.DisplayMember = "GroupName"; DAL.Towns objF = new DAL.Towns(); objF.connectionstring = objDAL.connectionstring; dt = objF.getRecord(string.Empty); CmbFilterTown.ValueMember = "TownID"; CmbFilterTown.DisplayMember = "TownName"; CmbFilterTown.DataSource = dt; } catch (Exception exc) { MessageBox.Show(exc.Message); } }