private void PopulateCombos() { try { DataTable dt = new DataTable(); DAL.Offices obj = new DAL.Offices(); obj.connectionstring = objDAL.connectionstring; dt = obj.getRecord(string.Empty); CmbOffice.ValueMember = "OfficeID"; CmbOffice.DisplayMember = "Description"; CmbOffice.DataSource = dt; DAL.PartyGroups objF = new DAL.PartyGroups(); objF.connectionstring = objDAL.connectionstring; dt = objF.getRecord(string.Empty); CmbGroups.ValueMember = "GroupID"; CmbGroups.DisplayMember = "GroupName"; CmbGroups.DataSource = dt; } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void LoadGrid() { try { //Grid.Rows.Clear(); string vWhere = string.Empty; if (!string.IsNullOrEmpty(TxtName.Text)) { vWhere = " AND Description Like '%" + TxtName.Text + "%'"; } DataTable dt = objDAL.getRecord(vWhere); Grid.AutoGenerateColumns = false; Grid.DataSource = dt; } catch (Exception exc) { MessageBox.Show("Error!!", exc.Message); } }