private void SearchFor() { bool isIncludeExpiredPackagesEnabled = false; dgvMainPage.DataSource = null; //search for Packages if (rdbPackage.Checked) { grpListOf.Text = "List Of Package"; isIncludeExpiredPackagesEnabled = true; dgvMainPage.DataSource = PackageDB.GetPackages(txtSearch.Text, chbIncludeExpiredPackages.Checked); hideColumn(5); hideColumn(6); dgvMainPage.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; } //search for Products if (rdbProduct.Checked) { grpListOf.Text = "List Of Products"; dgvMainPage.DataSource = ProductDB.SearchProducts(txtSearch.Text); dgvMainPage.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } //search for Suppliers if (rdbSupplier.Checked) { grpListOf.Text = "List Of Suppliers"; dgvMainPage.DataSource = SupplierDB.SearchSuppliers(txtSearch.Text); dgvMainPage.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } //search for Agents if (rdbAgents.Checked) { grpListOf.Text = "List Of Agents"; dgvMainPage.DataSource = AgentDB.SearchAgents(txtSearch.Text); dgvMainPage.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; hideColumn(8); } chbIncludeExpiredPackages.Enabled = isIncludeExpiredPackagesEnabled;//enable 'IncludeExpiredPackages' box or not this.Refresh(); EnableDisableEditButton(); //dgvMainPage.Columns[columNo].Visible = false; }